Click to See Complete Forum and Search --> : Cron Help


Troy Arnold
04-12-2001, 11:00 AM
Looking for a cut and dry way to for me to understand cron and how to get it running correctly.

ph34r
04-12-2001, 11:43 AM
man crontab


Basically, you submit a schedule of when you want a script/program run. You can do it every minute of every day of every month if you want, or variations there of.

Troy Arnold
04-12-2001, 12:10 PM
I have read the man pages on crontab and cron and seem to have found various ways to do this, howver none seem to work. I have wrote a small script that moves files from my home directory to /var/www/html for web purposes. I want this to happen once an hour. I placed my file in the cron.hourly directory and modified the crontab in /etc to reflect the correct time for the cron to run. I also have checked to see if the cron is installed for the root user by doing a crontab -l and the cron shows up correctly. I have even manauly start and stopped the cron dameon in /etc/rc.d/init.d. Any help would be great...

X_console
04-12-2001, 07:15 PM
Scheduling in Linux: http://www.linuxnewbie.org/nhf/intel/misc/scheduling.html

tnordloh
04-13-2001, 02:34 AM
I was going to post some instructions, but that nhf does a far better job than I could.

Craig McPherson
04-13-2001, 04:35 AM
I just use the global crontab file (/etc/crontab) for everything.

This is what an entry looks like:

1 7 * * * root /usr/bin/command

The five slots for numbers represent the following: minutes, hours, day-of-month, month, day-of-week

This above example means "run it one minute past the seventh hour of the day (7:01), every day of the week, every month, every day of the week. If you wanted to run something once an hour every hour, but only on Thursday, you could do this: 5 * * * 5, which means five minutes past the hour, every hour, every day of every month, as long as that day happens to be a Thursday. (I say Thursday is 5 because I think it starts counting with Sunday as 1... if it starts at Monday, then Thursday is 4, so be sure to check that.)

After the numbers specifying when to run the command, you put the username you want to run it as. In the above, root. After that comes the command to run. That's all there is to it.