zoukankan      html  css  js  c++  java
  • 关于根据 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

  • 相关阅读:
    危险无处不在 Html标签带来的安全隐患
    【转】服务器不支持FLV的解决办法
    IE8采用IE7模式
    解决IE中img.onload失效的方法
    字符串操作>静态串String
    装sql2005 express
    抽象类
    字符串操作>动态串StringBuilder
    使用数组
    集合>数组集合ArrayList
  • 原文地址:https://www.cnblogs.com/tgzmos/p/14657975.html
Copyright © 2011-2022 走看看