Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need cron shell script to move files

Status
Not open for further replies.

loosebruce

Programmer
May 28, 2002
6
US
I've never done this before, and any help is appreciated.

I need to move files from /usr/people/my_directory to /opt/apache/htdocs every half hour.

Someone suggested cron and a shell script. I don't know anything about either, but it sounds like the best solution for me.

I'm running SGI/IRIX and Apache.
 
Hi:

Here's my answer to your question: (Not Tested!)

PATH=..
cd /usr/people/my_directory; tar cf - .|(cd /opt/apache/htdocs; tar xf - )


The above command changes to the source directory and creates a tar archive.
The "f" option with a dash means use standard output and the period includes the
current directory in the archive. Since this command is piped, the standard
output of the archive becomes the standard input of the tar extraction
creating the required copy. The parenthesis groups commands before the tar
extraction takes place.

If the above command is called script.ss. To run this from cron every
half-hour:

0,30 * * * * script.ss

Regards,


Ed
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top