15 lines
353 B
Plaintext
15 lines
353 B
Plaintext
|
#!/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 {} \;
|