Crontab 配置

0 21 * * 6 /bin/sh /root/time.sh            #"6"代表周六

时间判断脚本如下:

#!/bin/bash
if [ "$(date -d "+7 days" +%d)" -gt "$(date +%d)" ]             #如果是每月第一周将"-gt"该为"-lt"
    then
        echo "False"
else
        /bin/sh /root/server.sh
fi

  

posted on 2018-10-31 14:35  a120608yby  阅读(1659)  评论(0编辑  收藏  举报