custom_log_rotate_script
This is an old revision of the document!
Custom Log rotate script
- | custlogrotate.sh
#!/bin/sh yesterday=`date -v-1d '+%Y%m%d'` mkdir /home/log/log.$yesterday for i in `ls /home/log | grep $yesterday` do echo $i mv $i /home/log/log.$yesterday done tar -cvf /home/log/log$yesterday.tar.gz /home/log/log.$yesterday rm -rf /home/log/log.$yesterday chown -R user:group /home/log
custom_log_rotate_script.1244127675.txt.gz ยท Last modified: 2020/08/10 02:29 (external edit)