简体   繁体   中英

How set cron job - PHP in digital ocean for daily bases?

I have set cron job command on my digital ocean server. 0 1 * * * php /var/www/html/domain/cron/index.php is it right coded?? Because its not running daily. Had check of 5mint and hourly, its working fine but not for each day. Please help me to find out the solution. Thanks in Advance.

0 1 * * * means your php file will execute on 01:00:00, and this depend on your where your server is located (server's time zone).

Check this site. it will help you to set time for your cron job.

and if your cron is running for 5 minute, it should work for daily basis, you have to just figure out at what time it should run.

Check if your cron commands are OK by typing:

$ crontab -l

or right in

/var/spool/cron/crontab

Your command seems to be OK for a script that will be executed every day at 01AM.

Login to your droplet and then follow this steps

crontab -e
* * * * * cd project_path/ && php artisan schedule:run 1>> /dev/null 2>&1

Example:

* * * * * cd /var/www/html/blog/ && php artisan schedule:run 1>> /dev/null 2>&1

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