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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

crontab

Status
Not open for further replies.

nareshbabu

Programmer
Feb 13, 2003
2
0
0
US
Hi ,

i have to execute a script for every 4 hrs. How should
i give it in the crontab entry.

Thanks
 
Under hours 0,4,8,12,16,20 or something to that effect.
Ed Fair
unixstuff@juno.com
Any advice I give is my best judgement based on my interpretation of the facts you supply. Help increase my knowledge by providing some feedback, good or bad, on any advice I have given.
 
why should cron be informed of the time your job have to run ?? let your job decide itself.

in cron: * * * * * /thePath/theJob

in /thePath/theJob

#!/bin/sh
case `date +%H` in [0|4|8|12|16|20|24]);; *) exit;; esac
exec the rest
 
Because that's cron's job. ;-)

By the way, your solution would run the job every minute of the fourth hour, eighth hour, etc. You could use 0 * * * * as the cron schedule perhaps... or test for date +%H%M being 0000, 0400, etc. in your case statement. Annihilannic.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top