# 注释crontab任务
crontab -l > ${WORK_DIR}/cron_binary
sed -i 's%\(.*/home/xyz/xyz.sh\)%#\1%' ${WORK_DIR}/cron_binary
crontab ${WORK_DIR}/cron_binary
# 恢复crontab
crontab -l > ${WORK_DIR}/cron_binary
sed -i 's%\(^##*\)\(.*/home/xyz/xyz.sh\)%\2%' ${WORK_DIR}/cron_binary
crontab ${WORK_DIR}/cron_binary
用你的任务名替换上面的/home/xyz/xyz.sh, 然后写成脚本加到crontab中定时执行, 就OK
阅读(3566) | 评论(0) | 转发(0) |