크론 설정
예약 작업 목록을 보고 싶다면 다음과 같이 명령합니다.
crontab -l
예약 작업을 모두 삭제하고 싶다면 다음과 같이 명령합니다.
crontab -r
예약 작업을 만들거나 수정하고 싶다면 다음과 같이 명령합니다.
crontab -e
crontab 파일이 없다면 새로 만들고, 있다면 그 파일을 엽니다.
minute hour day month weekday command
minute : 0 - 59
hour : 0 - 23
day : 1 - 31
month : 1 - 12
weekday : 0 - 6 (0 : 일요일)
command : 수행하려는 작업 명령어
*/10 4 * * * /root/backup.sh
10분 간격, 4시, 매일, 매월, 매요일, 즉 매일 4시, 4시 10분, 4시 20분, 4시 30분, 4시 40분, 4시 50분에 /root/backup.sh를 실행하시오.
* */6 * * * /root/Bugbounty/cron_recon.sh
매일 6시간 간격으로 작업 실행
크론 로그 남기기
On a default installation the cron jobs get logged to
/var/log/syslog
You can see just cron jobs in that logfile by running
grep CRON /var/log/syslog
If you haven't reconfigured anything,the entries will be in there.
Sometimes it can be useful to continuously monitor it, in that case:
tail -f /var/log/syslog | grep CRON
This will redirect all standard output and errors that may be produced by the script that is run to the log file specified.
You can also direct the output of the individual cronjobs to their own logs for better readability, you will just need to append the output of date somewhere.
01 14 * * * /home/joe/myscript >> /home/log/myscript.log 2>&1
'Recon' 카테고리의 다른 글
SCP, CAT, MAIL, ZIP, TAR, SCREEN (0) | 2020.01.25 |
---|