美文网首页
(转)Linux 执行定期任务

(转)Linux 执行定期任务

作者: 松爱家的小秦 | 来源:发表于2018-08-28 05:15 被阅读0次

    # m h dom mon dow command

    # * * * * * command to execute

    # ┬ ┬ ┬ ┬ ┬

    # │ │ │ │ │

    # │ │ │ │ │

    # │ │ │ │ └─day of week(0-7)(0 to 6 are Sunday to Saturday,or use names;7 is Sunday,the same as 0)

    # │ │ │ └────────── month (1 - 12)

    # │ │ └─────────────── day of month (1 - 31)

    # │ └──────────────────── hour (0 - 23)

    # └───────────────────────── min (0 - 59)

    使用方法:进入root用户:

    输入:

    crontab -e在文件尾添加:

    */20  *  *   *   *   /etc/network/if-down.d/net_restart.sh

    0    17   */1  *   *   /etc/network/if-down.d/net_reboot.sh

    表示每20分钟执行一次net_restart.sh脚本,检查网络是否连通。每天的17:00执行net_reboot.sh,如网络断开则重启一次树莓派。

    相关文章

      网友评论

          本文标题:(转)Linux 执行定期任务

          本文链接:https://www.haomeiwen.com/subject/egwxwftx.html