리눅스 crontab 특정행 주석처리

Jmnote bot (토론 | 기여)님의 2016년 3월 29일 (화) 12:20 판 (봇: 자동으로 텍스트 교체 (-<source lang='cli'> +<source lang='console'>))
(차이) ← 이전 판 | 최신판 (차이) | 다음 판 → (차이)
리눅스 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 }}