Posts Tagged crontab

Running Cron on Selected Days of the Week

I can never remember how to setup cron.

This example shows how to set up a job to run on selected days of the week.

MAILTO=babbysandpants@bogusdomain.com
 
# minute hour "day of month" month "day of week"
# 5 past midnight on mon-fri (sun 7or0, mon-sat is 1-6)
5  0  *  *  1-5 /home/list/cron.sh
 
# this one runs at 9:53AM mon to friday
# 53  9  *  *  1-5 /home/list/cron.sh
 
# this one runs at 2:10 am mon,wed,fri
10  2  *  *  1,2,5 /home/list/cron.sh

1 monday
2 tuesday
3 wednesday
4 thursday
5 friday
6 saturday
0,7 Sunday

,

No Comments

Running Cron Every X Minutes

I keep forgetting the correct format of cron entries to have a command run every three minutes

To do it every three minutes you need to make the syntax */3 not simply 3 (which means on the 3rd minute of every hour)

# m h  dom mon dow   command
*/3 * * * * /home/user/bin/mycommand

This cron job now runs as I want…

# m h dom mon dow command
The above is the format eg.
m = minutes
h = hours
dom = day month
mon = month
dow = day of week
command = command

,

No Comments