Welcome to WebmasterWorld Guest from 50.17.79.100

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Cron Job Assistance

     

woldie

5:04 pm on Jan 27, 2005 (gmt 0)

10+ Year Member



Hi,

I'm having a spot of bother with the cron job shown below.

What it suppose to do is:

1. Unzip the zip files in the given directory
2. Move the zip files into a zip directory
3. Move the log file after it has been unzipped into the logs directory.

The trouble I am having is that I'm not quite how to put this all together I've had a go, I've used the pipe command but I don't think that is the right command to use.

Code:

30 09 * * * /usr/bin/unzip /home/sites/test.domain.com/ex*.zip mv /home/sites/test.domain.com/ex*.zip /home/sites/test.domain.com/zips mv /home/sites/test.domain.com/ex*.log /home/sites/test.domain.com/logs

Thanks again.

johnt

5:09 pm on Jan 27, 2005 (gmt 0)

10+ Year Member



Put the commands that you want executed into a shell script, make sure that the script is executable and then call the script from your cronjob.

i.e

in script.sh

#!/bin/ksh
/usr/bin/unzip /home/sites/test.domain.com/ex*.zip
mv /home/sites/test.domain.com/ex*.zip /home/sites/test.domain.com/zips
mv /home/sites/test.domain.com/ex*.log /home/sites/test.domain.com/logs

and then in your cron file

30 09 * * * script.sh

Hope this works

John

woldie

5:17 pm on Jan 27, 2005 (gmt 0)

10+ Year Member



Thanks Johnt,

Much appreciated for the feedback, and so quick as well, nice! :o)

Woldie.

 

Featured Threads

Hot Threads This Week

Hot Threads This Month