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

  • 相关阅读:
    POJ 3187 Backward Digit Sums
    POJ 3669 Meteor Shower BFS
    POJ 1979 Red and Black DFS
    不想切题、
    企业管理信息系统成功实施的四个阶段
    linux下memcached的安装
    Apache开启伪静态示例
    网页设计基础知识
    memcached安装说明
    伪静态.htaccess的练习
  • 原文地址:https://www.cnblogs.com/tgzmos/p/14657975.html
Copyright © 2011-2022 走看看