下面提到的脚本有我的 crontab 运行功能。
# Chef Name: binary_log_purge 0 */4 * * * /engineyard/bin/binary_log_purge -q
# Chef Name: database_oom_score
*/30 * * * * /engineyard/bin/database_oom_adj
# Chef Name: logrotate -f /etc/logrotate.d/stats 0 * * * * logrotate -f /etc/logrotate.d/stats
# Chef Name: cpu_utilaisation
*/5 * * * * cd /tmp && sh cpu_util.sh >> cpu_utilaisation.log
# Chef Name: Test_script
*/2 * * * * cd /tmp && sh test.sh >> tests_cript.log
上述查询我想删除吹气线
# Chef Name: Test_script
*/2 * * * * cd /tmp && sh test.sh >> tests_cript.log
如何通过以下步骤删除该功能:
第1步:首先我想知道下面的行是否存在。我怎样才能知道?
*/2 * * * * cd /tmp && sh test.sh >> tests_cript.log
第 2 步:如果该线存在。我想删除该功能。我怎样才能删除该功能?
请帮帮我......
最佳答案
根据man 5 crontab
crontab 文件不能直接编辑。
你能做的就是运行crontab -l
,使用 grep -v
过滤掉该行,
运行crontab -r
清除 crontab,然后将 crontab 文件的修改版本通过管道传输到 crontab -
.
关于linux - 如何删除 crontab 中的特定行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35408241/