Add fix logrotate script.

This commit is contained in:
BoHung Chiu 2022-05-18 18:34:45 +08:00
parent a60a556f9c
commit 4ff3326812
1 changed files with 4 additions and 0 deletions

4
fix_logrotate.sh Normal file
View File

@ -0,0 +1,4 @@
sudo sed -i 's/-SIGUSR1/-USR1/g' /etc/logrotate.d/orbit
line_num=`grep '/var/log/mongodb/\*.log' /etc/logrotate.d/orbit -n | cut -d : -f 1`
end_num_plus=`cat /etc/logrotate.d/orbit | awk '{if (NR>='$line_num') print}'|grep '}' -n|cut -d : -f 1`
sudo sed -i $line_num,+$((end_num_plus-1))'s/copytruncate/create 644 mongodb mongodb/g' /etc/logrotate.d/orbit