Welcome to WebmasterWorld Guest from 3.234.214.113

Forum Moderators: bakedjake

Message Too Old, No Replies

Cron only runnning bash scripts on the hour

Cron only runnning bash scripts on the hour

     

psmith_8

12:17 pm on Aug 31, 2005 (gmt 0)

Inactive Member
Account Expired

 
 


Hi,
I'm fairly new to cron, I'm trying to make it run a bash script. I can only make it run the script at say 13:00 if I set it to run at 13:15, all the log files tell me that the script was executed with no errors, but it does not run the commands in the script.
3:14 pm on Aug 31, 2005 (gmt 0)

Preferred Member

10+ Year Member

joined:Aug 28, 2003
posts:366
votes: 0


First, let's see what your crontab looks like...
crontab -l

Secondly, does your script depend on any data or files to exist, or maybe it depends on what time it is, as well. :) It may be failing a test of some kind. If you're able to, post your script as well.

MM

10:34 am on Oct 4, 2005 (gmt 0)

New User

10+ Year Member

joined:July 5, 2005
posts:6
votes: 0


The following is a breakdown of a crontab line:

15 13 * * * /usr/bin/command
- - - - -

+----- day of week (0 - 6) (Sunday=0)
+------- month (1 - 12)
+--------- day of month (1 - 31)
+----------- hour (0 - 23)
+------------- min (0 - 59)

EDIT: The above graph contains multiple spaces and gets squished when posted.

This will run a command every day, at 13:15. The 3 stars following the 13 must exist for it to read the time/day format properly. If you want to run a command every Monday at 13:15, use:

15 13 * * 1 /usr/bin/command

If you want to run a command every 1st, 15th and 23rd of the month at 13:15, use: (note the commas between 1, 15 and 23)

15 13 1,15,23 * * /usr/bin/command

By default cron jobs will send an email to the user account executing the cronjob. If this is not needed put the following command at the end of the cron job line.

15 13 * * * /usr/bin/command >/dev/null 2>&1

424Boyz

 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members