• 关于根据 crontab 添加一个 1分钟执行一次的命令 错误的执行和正确执行


    关于根据 crontab  添加一个 1分钟执行一次的命令 错误的执行和正确执行

    错误的执行一:

    [www@localhost www]$ crontab -e -u www  * * * * *  php think  /www/index.php 
    crontab: usage error: no arguments permitted after this option
    usage: crontab [-u user] file
    crontab [-u user] [ -e | -l | -r ]
    (default operation is replace, per 1003.2)
    -e     (edit user's crontab)
    -l     (list user's crontab)
    -r     (delete user's crontab)
    -i     (prompt before deleting user's crontab)

    正确执行:
    [www@localhost www]$ crontab -e -u www

    默认使用vi编辑器来设定时程表

    * * * * *  php think  /www/index.php 

    编辑好后,摁下ecs,:wq,保存退出;然后需要重启crond,重启需要root帐号

    [www@localhost www]$ /sbin/service crond reload

    Redirecting to /bin/systemctl reload crond.service

    安装crontab:

    yum install crontabs

    服务操作说明:

    /sbin/service crond start //启动服务

    /sbin/service crond stop //关闭服务

    /sbin/service crond restart //重启服务

    /sbin/service crond reload //重新载入配置

    查看crontab服务状态:

    service crond status

    手动启动crontab服务:

    service crond start

    查看crontab服务是否已设置为开机启动,执行命令:

    ntsysv

    加入开机自动启动:

    chkconfig –level 35 crond on

  • 相关阅读:
    进制的转换
    输出蛇型矩阵
    输出弓形矩阵
    找出一个数组中出现次数最多的那个元素
    开灯问题
    find your present
    核反应堆
    Box of Bricks最小移动砖块数目
    超级楼梯
    Bootstrap中的 JavaScript 特效 — 下拉菜单和滚动监听插件
  • 原文地址:https://www.cnblogs.com/tgzmos/p/14657975.html
Copyright © 2020-2023  润新知