ansible-roles/mongodb-org-3/templates/mongo_log_rotate.sh.j2

15 lines
353 B
Plaintext
Raw Normal View History

2015-12-16 14:56:14 +01:00
#!/bin/bash
MONGO_PID_FILE={{ mongodb_dbpath }}/mongod.lock
LOG_RETAIN_DAYS={{ mongodb_log_retain_days }}
RETVAL=
MONGO_PID=$( cat $MONGO_PID_FILE )
# Tell mongo to rotate its log file
kill -SIGUSR1 $MONGO_PID
RETVAL=$?
# Remove the old log files
find {{ mongodb_logdir }} -name "{{ mongodb_log_file }}.*" -ctime +$LOG_RETAIN_DAYS -exec rm -f {} \;