Abude
Abude

Reputation: 2162

How to add an URL to a cron job on my server?

What i'm trying to do is to execute an URL once every 5 minutes, it's for an update to the database:

so first i'm accessing the crontab:

crontab -e

then i add to the existing list this line:

5 * * * * /usr/bin/curl http://www.example.com/index.php/update

and i checked the DB after 5 minutes but there's no updating info. What is that i'm doing wrong? did i skip a step without knowing?

Thanks in advance guys!

Upvotes: 0

Views: 190

Answers (2)

davidkonrad
davidkonrad

Reputation: 85568

1 : Check /var/log/syslog where you can se if the cronjob actually had been executed (not nessecarily successfully)

2 : The url looks a litte bit weird to me

http://www.example.com/index.php/update

should maybe be (typo??)

http://www.example.com/index.php?update

3 : As Ryan Hurling mentions,

5 * * * * /usr/bin/curl http://www.example.com/index.php/update

guess it should be

*/05 * * * * /usr/bin/curl http://www.example.com/index.php/update

4 : Tried

*/05 * * * * /usr/bin/wget curl http://www.example.com/index.php/update 

??

Upvotes: 1

Ryan Hurling
Ryan Hurling

Reputation: 287

change 5 * * * * to */5 * * * * and it will run the cron job every 5 minutes

Upvotes: 2

Related Questions