I made a script to rotate the logs every day, but my log files remain open after the rotation (see attachment).
Even if I restart the mongod processes, this problem will appear in the next few days.
Is there a problem with my script? Or the "kill -SIGUSR1 <pid>" command cannot be used when MongoDB is balancing?
Any suggestions or root cause guessing?
Thanks~
$ crontab -l
==========================
05 00 * * * /opt/log_bk.sh
$ cat /opt/log_bk.sh
==========================
#!/bin/sh
/bin/kill -SIGUSR1 `cat /opt/foo/conf/SB/SB11.pid 2> /dev/null` 2> /dev/null || true
mv /opt/foo/logs/SB/SB11.log.* /opt/foo/logsbk/SB
compress /opt/foo/logsbk/SB/SB11.log.*/bin/kill -SIGUSR1 `cat /opt/foo/conf/SB/SB31.pid 2> /dev/null` 2> /dev/null || true
mv /opt/foo/logs/SB/SB31.log.* /opt/foo/logsbk/SB
compress /opt/foo/logsbk/SB/SB31.log.*find /opt/foo/logsbk/SB/ -type f -name "*.Z" -mtime +7 -exec rm -rf {} \;