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

  • 相关阅读:
    Python环境变量的配置
    关于selenium+python的googledirver和iedirver的配置
    jdk1.6环境变量配置
    windows server 2012R2安装激活码
    Git生成SSHKey
    Linux下配置和安装VNCServer远程服务
    Win7 64位硬盘安装Ubuntu 64位的细微配置
    apache tomcat 8.0 显示目录文件
    跨域登录
    jsonp 代码优化
  • 原文地址:https://www.cnblogs.com/zhonghan/p/3090613.html
Copyright © 2011-2022 走看看