• 定时执行任务


    定时执行任务
    crontab –e : 修改 crontab 文件. 如果文件不存在会自动创建。
    crontab –l : 显示 crontab 文件。
    crontab -r : 删除 crontab 文件。
    crontab -ir : 删除 crontab 文件前提醒用户。
     
    5个参数
    minute   hour   day   month   dayofweek   command
    minute - 从0到59的整数
    hour - 从0到23的整数
    day - 从1到31的整数 (必须是指定月份的有效日期)
    month - 从1到12的整数 (或如Jan或Feb简写的月份)
    dayofweek - 从0到7的整数,0或7用来描述周日 (或用Sun或Mon简写来表示)
    command - 需要执行的命令(可用as ls /proc >> /tmp/proc或 执行自定义脚本的命令)
     
    1、在 凌晨00:01运行
    1 0 * * * /home/linrui/XXXX.sh
     
    2、每个工作日23:59都进行
    59 11 * * 1,2,3,4,5 /home/linrui/XXXX.sh
    或者如下写法:
    59 11 * * 1-5 /home/linrui/XXXX.sh
     
    3、每分钟运行一次
    */1 * * * * /home/linrui/XXXX.sh
     
    4、每个月的1号 14:10 运行
    10 14 1 * * /home/linrui/XXXX.sh

  • 相关阅读:
    杭电1058
    动态规划之背包模版
    按字典序依次打印只由1~n组成的n位数
    杭电1029
    杭电1257
    杭电2191
    杭电1114
    杭电2602
    南阳975
    杭电2138
  • 原文地址:https://www.cnblogs.com/qingzhenduyi/p/12048678.html
Copyright © 2020-2023  润新知