Ubuntu下添加定时任务执行php文件


//添加自动下载定时任务
1. vim /etc/crontab
2. 添加 #每5分钟执行一次
*/5 * * * * root /usr/bin/php /home/wwwroot/123.php
3. /etc/init.d/cron restart 重启cron
4.设置cron运行日志存放路径
sudo vi /etc/rsyslog.d/50-default.conf
将#cron.* 前的 # 删掉
5.重启rsyslog服务
/etc/init.d/rsyslog restart
/etc/init.d/cron restart 重启cron
6.查看日志文件
vim /var/log/cron.log
//参考地址
https://blog.csdn.net/LOUISLIAOXH/article/details/48242289

猜你喜欢

转载自www.cnblogs.com/liruning/p/8888853.html
今日推荐