开发者

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

开发者 https://www.devze.com 2023-04-01 02:11 出处:网络
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 redire

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 cron开发者_开发问答tab? How?


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)

0

精彩评论

暂无评论...
验证码 换一张
取 消