Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to call a URL periodically form a linux box (cron job)?

Tags:

cron

wget

I have a shell access on a Linux box where my Website resides.

I want to call a URL each hour on that Website (it's not a specific PHP file, I have codeigniter has a framework and some Apache redirects, so I really need to call a URL).

I guess I can use wget and crontab? How?

like image 211
mrmuggles Avatar asked Aug 31 '11 01:08

mrmuggles


1 Answers

Add this to /etc/crontab

0 * * * * wget -O - -q -t 1 http://www.example.com/cron.php

Alternatively, create a shell script in the /etc/cron.hourly

File: wget

#!/bin/sh
wget -O - -q -t 1 http://www.example.com/cron.php

make sure you chmod +x wget (or whatever filename you picked)

like image 135
Ivan Peevski Avatar answered Nov 15 '22 09:11

Ivan Peevski