根据关键词注释掉crontab中定时任务,取消任务的自动触发执行
crontab -l >/home/t.txt && sed -i '/Cassandra.sh/{s/^/#/g}' /home/t.txt && crontab /home/t.txt
避免以#开头的注释行累加,清除注释行
crontab -l >/home/t.txt && sed -i -e '/Cassandra.sh/d' -e '/^#/d' /home/t.txt && crontab /home/t.txt[@more@]
crontab -l >/home/t.txt && sed -i '/Cassandra.sh/{s/^/#/g}' /home/t.txt && crontab /home/t.txt
避免以#开头的注释行累加,清除注释行
crontab -l >/home/t.txt && sed -i -e '/Cassandra.sh/d' -e '/^#/d' /home/t.txt && crontab /home/t.txt[@more@]
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/23937368/viewspace-1056921/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/23937368/viewspace-1056921/
取消Cassandra.sh任务自动执行并清除注释
本文提供了一种方法来根据关键词注释掉crontab中定时任务,取消任务的自动触发,同时避免以#开头的注释行累加。通过使用sed命令编辑crontab文件,实现清除注释行的功能。
593

被折叠的 条评论
为什么被折叠?



