Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
nginx log rotation script
#!/bin/bash
LOGDIR=/usr/local/nginx/logs
PID=/usr/local/nginx/logs/nginx.pid
NOW=$(date +%Y%m%d-%H%M%S)
cd ${LOGDIR}
for i in *.log; do
mv ${i} ${i}.tmp.${NOW}
done
kill -USR1 $(cat ${PID})
sleep 1 #FIXME sleep time
if ls *.log >/dev/null 2>&1; then
for i in *.log.tmp.${NOW}; do
newfile=${i/.log.tmp.${NOW}/-${NOW}.log}
mv $i $newfile
bzip2 $newfile
done
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.