그냥 개발자 블로그

[Linux] Leave a crontab run log 본문

프로그래밍팁/linux

[Linux] Leave a crontab run log

마음이파파 2017. 6. 23. 04:16

To record an error, do the following.




1. Create an empty file.


$ vi naver_blog_cron.log

 



2. Press esc. Press :wq to save.


:wq

 



3. Modify the file permissions.


$ chmod 777 naver_blod_cron.log

 



4. 
Modify the crontab.


$ crontab -e

 



5. Enter your schedule. and  >> Type the log file path after.


45 * * * * /var/www/cron/naver_blog_cron.sh >> /var/www/log/naver_blog_cron.log 2>&1

 

[Operating time] [Operating file] >> [Log file path] 2>&1


6. Press esc. Press :wq to save.


:wq

 



7. Check the crontab list.


$ crontab -l

 




copyright (c) 2017 워크식스