homepage Welcome to WebmasterWorld Guest from 54.227.41.242
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
Cron Job Assistance
woldie

10+ Year Member



 
Msg#: 2741 posted 5:04 pm on Jan 27, 2005 (gmt 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.

 

johnt

10+ Year Member



 
Msg#: 2741 posted 5:09 pm on Jan 27, 2005 (gmt 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

woldie

10+ Year Member



 
Msg#: 2741 posted 5:17 pm on Jan 27, 2005 (gmt 0)

Thanks Johnt,

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

Woldie.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved