zoukankan      html  css  js  c++  java
  • linux关于任务计划

    1.一次性任务计划:at
      1)添加 在18:16时候重启服务器
      at 18:16
      >at init 6
      >at ctrl+d
    2)查看
      atq
      1 Mon Aug 20 21:09:00 2018 a root(job号是1 ...)
    3)删除
      atrm 1    #删除job号为1的job

    2.周期性任务计划:crontab
    1)添加
      crontab -e #进入编辑任务计划
      30 23 * * 6 /sbin/init 6 #每周六晚上23:30重启服务器
      00 01 * * 0 /sbin/init 6 #每周日凌晨01:30重启服务器
    2)查看
      crontab -l #查看任务计划
    3)删除
      crontab -r #删除该用户的全部任务计划
      crontab -e #单独编辑删除


    * * * * * 分 时 日 月 周
    00 03 * * * 每天凌晨三点
    30 23 * * * 每天23:30
    */5 * * * * 每隔五分钟
    59 23 * * 1-5 周一到周五23:59
    59 23 * * 1,3,5 周一、周三、周五的23:59

    任务计划的应用:

    shell脚本:
    #备份静态资源的shell脚本
    1)写脚本
    cd
    touch backup.sh

    #!/bin/bash
    t=`date +%Y.%m.%d`;
    f="pic-${t}.zip";
    cd /opt/web/
    zip -r $f * &>/dev/null
    mv $f /mnt


    2)任务计划
    crontab -e
    30 23 * * 6 /root/backup.sh


    3)查看
    cd /mnt
    ll

  • 相关阅读:
    水洼,八连杀
    友链
    万能转换字符类型到int ,int到string,string到char or char *等等
    蓝桥杯模拟赛题
    2020 03 21
    2019 12 02 reading
    CentOS 7 定时计划任务设置
    xinted &telnet
    2019 12 02 section C one
    【暖*墟】#洛谷网课1.30# 树上问题
  • 原文地址:https://www.cnblogs.com/teitey/p/9508844.html
Copyright © 2011-2022 走看看