Linux 给指定用户添加定时任务

2020-05-22  本文已影响0人  流浪君子

一般定时任务文件放在/etc/cron.d/ 文件下,比如以httpd用户添加定时任务:

cd /etc/cron.d

vim httpd.crontab  //添加需要执行的命令

# 给httpd用户添加定时任务脚本

比如:*/1 * * * * httpd /usr/local/php/bin/php /home/website/wechat-xiaozhangbang/artisan schedule:run >> /dev/null 2>&1

保存

crontab -u httpd httpd.crontab

/bin/systemctl restart crond.service   #重启服务

参考资料:https://blog.csdn.net/ren593669257/article/details/95455245

上一篇 下一篇

猜你喜欢

热点阅读