리눅스 crontab 특정행 주석처리

Jmnote bot (토론 | 기여)님의 2015년 2월 12일 (목) 01:46 판 (로봇: 자동으로 텍스트 교체 (-[root@jmnote +[root@zetawiki))
리눅스 crontab 특정행 주석처리

1 방법 1: 명령어 찾아 주석처리

  • 해당 명령어가 있는 줄을 주석 처리함
crontab -l | sed -e 's/\(.*명령어\)/#\1/' | crontab
[root@zetawiki ~]# crontab -l
* * * * * /root/every_1min.sh
15,45 * * * * /root/every_30min.sh
[root@zetawiki ~]# crontab -l | sed -e 's/\(.*every_30min.sh\)/#\1/' | crontab
[root@zetawiki ~]# crontab -l
* * * * * /root/every_1min.sh
#15,45 * * * * /root/every_30min.sh

2 방법 2: n번째 행 주석처리

crontab -l | sed "행번호s/\(.*\)/#\1/g" | crontab
[root@zetawiki ~]# crontab -l
* * * * * /root/every_1min.sh
15,45 * * * * /root/every_30min.sh
[root@zetawiki ~]# crontab -l | sed "2s/\(.*\)/#\1/g" | crontab
[root@zetawiki ~]# crontab -l
* * * * * /root/every_1min.sh
#15,45 * * * * /root/every_30min.sh

3 같이 보기

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}