How can I setup a cron job in debian to run a certain url once every hour. There`s no control panel or anything.
Asked
Active
Viewed 4,545 times
4 Answers
6
You can do that in different ways:
- Make a simple script to run the command and copy it to
/etc/cron.hourly(don't forget to add the execute permission on it). - Add a snippet of
crontabto/etc/cron.d. - Use
crontab -eas root and add a line to it executing the command directly.
To access an URL you can use links, lynx, wget, curl and other text mode browsers. Each one will have it's quirks. I suppose curl or wget can be the easier ones to use.
I strongly recommend you to read this article as well as the cron manpage.
coredump
- 12,921
4
Edit /etc/crontab and add a line like the following:
0 * * * * root /path/to/executable
Or you can put it in your user crontab by running crontab -e and add the same line but omit the username field.
Of course, as others have said, you can add a script or symlink to /etc/cron.hourly.
Dennis Williamson
- 64,083
1
Command scheduling with cron. Take a look at /etc/cron.hourly. Everything you place in there will get executed each and every hour.
jliendo
- 1,578