How to set cron for a drupal site
So you've got yourself a drupal site and you're super tired of running cron by hand every day, or every time you want to refresh your news feeds or whatever...
Maybe you like running cron manually all the time, if so, stop reading now and go get a muffin...
Anyway, here's how to do it in a few easy steps, aka the agaric way...
First, go to your command line and type:
sudo crontab -l
That'll show you what's already scheduled to run...
Then, type:
sudo whereis wget
To confirm the location of wget --> probably, /usr/bin or something
Finally, type:
sudo crontab -e
This will open up a file and you'll probably see at least a line showing you the proper syntax for running cron...
anyway on a new line for each site you want to run cron on, use this:
45 * * * * /usr/bin/wget -O - -q http://www.example.com/cron.php
Make sure you save the file with ctrl+O then hit ctrl+x to exit..
Thats it! cron will run at 45 minutes past the hour on every site you setup...
Referenced:
http://drupal.org/node/31549
http://kevin.vanzonneveld.net/techblog/article/schedule_tasks_on_linux_u...

Awesome Dan!
A user interface someday to look and maybe set what cron we have for every site, but
crontab -l(that's a lowercase L if you aren't copy-pasting) sure isn't hard.We do want to be able to set cron from a bash script, Agaric's addsite script. Crontab seems to be an actual file (can't find it though) so there should be a way to pipe output to be added to the end of it... (to be continued)
And the
whereiscommand is so much better thanlocateat actually finding what you need! Great work Dan!how to tell cron to run on a file on the server?
Dan Hak: i assume you can tell cron to run whatever command you want on a recurring basis
I3IVIIVI: do you remember what's typed? or if you documented? just to get into cron?
Dan Hak: yea I documented that I m sure
[Agaric's page here didn't answer, but]
I3IVIIVI: bloody hell we just have to put it in the directory labeled "hourly"
#Run command at 7:00am each weekday [mon-fri]
00 07 * * 1-5 mail_pager.script 'Wake Up'
#Run command on 1st of each month, at 5:30pm
30 17 1 * * pay_rent.script
#Run command at 8:00am,10:00am and 2:00pm every day
00 8,10,14 * * * do_something.script
#Run command every 5 minutes during market hours
*/5 6-13 * * mon-fri get_stock_quote.script
#Run command every 3-hours while awake
0 7-23/3 * * * drink_water.script
do it! the agaric way... (example below)
#Run cron every 5 minutes...
*/5 * * * * /usr/bin/wget -O - -q http://www.example.com/cron.php
got it?
good.