简体   繁体   中英

Setting up the crontab on amazon ec2 cloud (Linux server)

I need to run a php file on every 2 hours, so i am using this command

* */2 * * * /usr/bin/php /var/www/html/sports/webservices/rss-insert.php

i am also using this

* */2 * * * php /var/www/html/sports/webservices/rss-insert.php

But both are not working. can anyone help me.

Thanks

The crontab you have made will run every minute of every second hour rather than every two hours.

In order to get it to run every two hours you need something like this:

5 */2 * * * /usr/bin/php /var/www/html/sports/webservices/rss-insert.php

which will run it 5 minutes after every second hour eg 2:05, 4:05...

This is assuming your script is able to run. Try running the command portion from the cron by hand at the command line and make sure it does what you want.

这对我有用,对您肯定有用。

0 0-23/2 * * * php /var/www/html/sports/webservices/rss-insert.php

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM