zoukankan      html  css  js  c++  java
  • crontab example.

    Example:

    执行如下步骤创建一个crontab

    1,# cd /opt/test/

    2,先touch 文件 test-crontab.sh 内容如下(表示每分钟执行一次脚本/opt/test/test.sh)

          */1    *   *     *     *    /opt/test/test.sh

    3, touch 文件 test.sh 内容如下

          echo "`date` hello" >> /opt/bin/dat.txt

    4, chmod +x test-crontab.sh test.sh (加可执行权限)

    5,执行下面启动该crontab

         # crontab test-crontab.sh

    ***************************************************************************

    分         时       日        月       星期

    */1       *        *          *        *    /opt/test/test.sh    => 每1分钟执行test.sh

    0       */2        *          *        *    /opt/test/test.sh    => 每2小时执行test.sh

    30        9        *          *        *    /opt/test/test.sh    => 每天9点30分执行test.sh

    0          8        *          *      1-5    /opt/test/test.sh    =>星期一到星期5的8点执行test.sh

    *          *        *          *      */5    /opt/test/test.sh    => 每1分钟执行test.sh

    **************************************************************************

    #查看 [user用户下的] crontab

    crontab [-u user] -l  

    #删除 contab

    crontab [-u user] -r

    #编辑contab

    crontab [-u user] -e

  • 相关阅读:
    TODO C++ lambda表达式
    C++ Map实践
    【转】C++ typedef typename 作用
    C++ Vector实践
    再学引用
    设置table中的td一连串内容自动换行
    JavaScript中基本数据类型和引用数据类型的区别
    “浏览器模式”和“文档模式”之间的区别
    浏览器模式与文档模式区别
    HTML5中的data-*属性和jQuery中的.data()方法使用
  • 原文地址:https://www.cnblogs.com/zhonghan/p/3090613.html
Copyright © 2011-2022 走看看