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

  • 相关阅读:
    Flutter图片选择 image_picker(官方)插件使用详解
    androidstudo如何跨越这个厚厚的墙,亲测有效 Could not resolve com.android.tools.build:gradle:
    qwq。。胡诌qwq
    关于很狗的军训qwq
    Leetcode每日一题 503.下一个更大元素II
    C++ 关于volatlie
    C++虚成员函数与动态联编
    graphics pipeline
    pointer or function
    线段树
  • 原文地址:https://www.cnblogs.com/zhonghan/p/3090613.html
Copyright © 2011-2022 走看看