Welcome to WebmasterWorld Guest from 54.144.80.75

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Cron Job Assistance

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

Full Member

10+ Year Member

joined:Feb 13, 2003
posts:220
votes: 0


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.

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

New User

10+ Year Member

joined:Sept 30, 2004
posts:18
votes: 0


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

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

Full Member

10+ Year Member

joined:Feb 13, 2003
posts:220
votes: 0


Thanks Johnt,

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

Woldie.

 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members