debian多条定时任务crontab -e 简单设置
编辑:
crontab -e
15 * * * * /bin/bash /root/renwu/lzzycj.sh
20 * * * * /bin/bash /root/renwu/lzzycjxz.sh
#*/2 * * * * /bin/bash /root/renwu/lzzycj.sh >> /root/renwu/lzzycj.log 2>&1
#*/2 * * * * /bin/bash /root/renwu/lzzycjxz.sh >> /root/renwu/lzzycjxz.log 2>&1
#15 * * * * curl -k https://xxx.xxx/api.php/timming/index.html?enforce=1&name=lzicj
#20 * * * * curl -k https://xxx.xxx/api.php/timming/index.html?enforce=1&name=lzicj-down
创建批处理文件 sh
mkdir -p /root/renwu
nano lzzycj.sh
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
curl -k --connect-timeout 10 -m 3600 'https://xxx.xxx:8443/api.php/timming/index.html?enforce=1&name=lzicj'
#curl --insecure --connect-timeout 10 -m 3600 'https://xxx.xxx:8443/api.php/timming/index.html?enforce=1&name=lzicj'(无ssl认证)
#curl -sS --connect-timeout 10 -m 3600 'https://xxx.xxx:8443/api.php/timming/index.html?enforce=1&name=lzicj'(有ssl认证)
echo "----------------------------------------------------------------------------"
endDate=`date +"%Y-%m-%d %H:%M:%S"`
echo "★[$endDate] Successful"
echo "----------------------------------------------------------------------------"
重启定时任务
/etc/init.d/cron restart
service cron restart