zoukankan      html  css  js  c++  java
  • linux的任务调度

    1,lsattr -a crontab 查看 crontab 文件的属性,如果有 i 表示 root 用户不能编辑 crontab 文件

    2,chattr -i crontab 去掉 crontab 文件的i属性

    3,使用 root 用户编辑该文件,在文件中加入调度要执行的任务: 比如 */1  *  *  *  * root       /root/echo.sh  表示每分钟执行 /root/echo.sh 脚本

    4, /root/echo.sh 脚本中加入 echo "你好" >> /root/1.txt  ,输出“你好”打 1.txt 文件

    5,以上表示每分钟输出 “你好” 到文件 1.txt 文件中

    6,service crond start 启动服务即可开始执行调度任务

      service crond stop 停止调度

      service crond restart 重启调度

      service crond status 查看 cron 的启动状态, cron 是 linux 操作系统自带的

    7,如果没有安装

    1. yum install vixie-cron    // vixie-cron 软件包是 cron 的主程序;
    2. yum install crontabs     // crontabs 软件包是用来安装、卸装、或列举用来驱动 cron 守护进程的表格的程序。
    3. 然后启动 crond 服务即可
  • 相关阅读:
    Array
    StringBuffer
    String
    字节流
    正则表达式
    coursera 机器学习 linear regression 线性回归的小项目
    立个FLAG!
    排序题目练习(Ignatius and the Pincess IV、排序、Clock、排名)
    codeforces 1006
    codeforces
  • 原文地址:https://www.cnblogs.com/moxiaodan/p/14001395.html
Copyright © 2011-2022 走看看