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,212 times
-4
-
2Same as on every other distro. – Ignacio Vazquez-Abrams Mar 11 '11 at 04:20
-
where`s the file located – Belgin Fish Mar 11 '11 at 04:22
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
crontab
to/etc/cron.d
. - Use
crontab -e
as 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.
![](../../users/profiles/48752.webp)
coredump
- 12,573
- 2
- 34
- 53
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
.
![](../../users/profiles/1293.webp)
Dennis Williamson
- 60,515
- 14
- 113
- 148
1
Command scheduling with cron. Take a look at /etc/cron.hourly. Everything you place in there will get executed each and every hour.
![](../../users/profiles/25316.webp)
jliendo
- 1,568
- 11
- 13