Skip to content
Permalink
Browse files

Ensure log rotation doesn't fail if nginx isn't running (i.e. on an i…

…nstance not in the web role)
  • Loading branch information...
pauldowman committed Jan 11, 2010
1 parent d2ac412 commit ad7c6ef6bba3a90c03d3f7c9c7f87bdaccd82fd9
Showing with 12 additions and 8 deletions.
  1. +9 −7 server/files/etc/cron.daily/logrotate_post
  2. +3 −1 server/files/etc/logrotate.d/nginx
@@ -10,13 +10,15 @@ if [ -x /mnt/app/current ] ; then
fi
fi

for f in `ls /mnt/log/nginx/*.log` ; do
logfile=$f-`date +%Y%m%d`
if [ -e $logfile ] ; then
gzip -c $logfile > $logfile.gz
/usr/local/ec2onrails/bin/archive_file --file $logfile.gz --dir logs/nginx && rm $logfile.gz
fi
done
if [ -e /mnt/log/nginx/access.log ] ; then
for f in `ls /mnt/log/nginx/*.log` ; do
logfile=$f-`date +%Y%m%d`
if [ -e $logfile ] ; then
gzip -c $logfile > $logfile.gz
/usr/local/ec2onrails/bin/archive_file --file $logfile.gz --dir logs/nginx && rm $logfile.gz
fi
done
fi

logfile=/mnt/log/varnish/varnishncsa.log-`date +%Y%m%d`
if [ -e $logfile ] ; then
@@ -5,6 +5,8 @@
dateext
sharedscripts
postrotate
test -f /var/run/nginx.pid && kill -USR1 `cat /var/run/nginx.pid`
if [ -f /var/run/nginx.pid ] ; then
kill -USR1 `cat /var/run/nginx.pid`
fi
endscript
}

0 comments on commit ad7c6ef

Please sign in to comment.
You can’t perform that action at this time.