美文网首页
Linux 给指定用户添加定时任务

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

作者: 流浪君子 | 来源:发表于2020-05-22 09:13 被阅读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

    相关文章

      网友评论

          本文标题:Linux 给指定用户添加定时任务

          本文链接:https://www.haomeiwen.com/subject/ogvfahtx.html