zoukankan      html  css  js  c++  java
  • linux crontab 定时任务使用 睁yan

    1 centos 安装

    yum install crontabs
    

    2 编辑配置

     crontab -e
    

     实例

    1 0 * * *  /opt/backup/back_mysql.sh  >> /opt/backup/backup.log  #(每天的0点01分执行
    
    */20 * * * *  /usr/bin/python /opt/switch_agent_pool/switch_ip.py    #20分钟执行一次
    

      


    实例1:每1分钟执行一次myCommand * * * * * myCommand 实例2:每小时的第3和第15分钟执行 3,15 * * * * myCommand 实例3:在上午8点到11点的第3和第15分钟执行 3,15 8-11 * * * myCommand 实例4:每隔两天的上午8点到11点的第3和第15分钟执行 3,15 8-11 */2 * * myCommand 实例5:每周一上午8点到11点的第3和第15分钟执行 3,15 8-11 * * 1 myCommand 实例6:每晚的21:30重启smb 30 21 * * * /etc/init.d/smb restart 实例7:每月1、10、22日的4 : 45重启smb 45 4 1,10,22 * * /etc/init.d/smb restart 实例8:每周六、周日的1 : 10重启smb 10 1 * * 6,0 /etc/init.d/smb restart 实例9:每天18 : 00至23 : 00之间每隔30分钟重启smb 0,30 18-23 * * * /etc/init.d/smb restart 实例10:每星期六的晚上11 : 00 pm重启smb 0 23 * * 6 /etc/init.d/smb restart 实例11:每一小时重启smb 0 */1 * * * /etc/init.d/smb restart 实例12:晚上11点到早上7点之间,每隔一小时重启smb 0 23-7/1 * * * /etc/init.d/smb restart

    命令

    service crond start //启动服务
    service crond stop //关闭服务
    service crond restart //重启服务
    service crond reload //重新载入配置
    service crond status //查看服务状态
    

      

  • 相关阅读:
    SQL Function(方法)
    SQL Cursor(游标)
    SQL Proc(存储过程)/tran(事物)
    AAABBBBCCCC
    Visual Studio2012中搭建WCF项目
    关于抽象工厂模式
    C#面向对象的学习笔记
    休假回来 更博-MySQL以月为单位的客户综合情况表_20161008
    结合Mysql和kettle邮件发送日常报表_20161001
    MySQL-with rollup函数运用 _20160930
  • 原文地址:https://www.cnblogs.com/zhangshijiezsj/p/15736353.html
Copyright © 2011-2022 走看看