diff --git a/fix_logrotate.sh b/fix_logrotate.sh new file mode 100644 index 0000000..922a8a8 --- /dev/null +++ b/fix_logrotate.sh @@ -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 \ No newline at end of file