shell script to create folder daily with time-stamp and push time-stamp generated logs

后端 未结 2 1712
囚心锁ツ
囚心锁ツ 2021-02-06 11:27

I have a cron job which runs every 30 minutes to generate log files with time-stamp like this:

test20130215100531.log, 
test20130215102031.log  
2条回答
  •  南笙
    南笙 (楼主)
    2021-02-06 11:56

    You should use logrotate! It can do this for you already, and you can just write to the same log file.

    Check their man pages for info: http://linuxcommand.org/man_pages/logrotate8.html

提交回复
热议问题