开发者

Run PHP script at regular intervals using CRON

开发者 https://www.devze.com 2023-03-23 05:14 出处:网络
I am kinda newbie t开发者_开发技巧o this, I have a php script which I want to execute after every 1 hour, for this I updated the crontab file inside the /etc directory but I am not able to see whether

I am kinda newbie t开发者_开发技巧o this, I have a php script which I want to execute after every 1 hour, for this I updated the crontab file inside the /etc directory but I am not able to see whether its actually being called.

Here's the entry in my crontab file

SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/

# run-parts
01 * * * * root run-parts /etc/cron.hourly
02 4 * * * root run-parts /etc/cron.daily
22 4 * * 0 root run-parts /etc/cron.weekly
42 4 1 * * root run-parts /etc/cron.monthly

*/5 * * * * /usr/bin/curl -o temp.txt http://myurl.com/postparser.php

I am not even able to see any temp.txt file getting generated Can someone point me in the right direction


try running

*/5 * * * * /usr/bin/php /path/to/php/file/postparser.php

Change the /usr/bin/php part to your php executable path.


Not sure about this but, changing just the file would have no effect. Try editing the tasks using the command crontab -e ("e" for editing).

If you want to edit the crontab for a certain user, use the -u parameter

for more, check the man: http://linux.die.net/man/1/crontab

Good luck

0

精彩评论

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