본문 바로가기

개발이야기

crontab grep 특정 문자 찾는 방법 & crontab 옵션 정리

 

crontab 내부에 있는 line 중, 특정 문자열(ex. target 문자)이 들어간 줄만 grep하고 싶다면?

$ crontab -l | grep 'target'

 

 

 

 

crontab option list

 

file Load the crontab data from the specified file. If file is a dash ("-"), the crontab data is read from standard input.
-u user Specifies the user whose crontab is to be viewed or modified. If this option is not given, crontab opens the crontab of the user who ran crontab. Note: using su to switch users can confuse crontab, so if you are running it inside of su, always use the -u option to avoid ambiguity.
-l Display the current crontab.
-r Remove the current crontab.
-e Edit the current crontab, using the editor specified in the environment variable VISUALor EDITOR.
-i Same as -r, but gives the user a yes/no confirmation prompt before removing the crontab.
-s SELinux only: appends the current SELinux security context string as an MLS_LEVELsetting to the crontab file before editing or replacement occurs. See your SELinux documentation for detailed information.

 

 

 

 

 

 

 

 

 

반응형