Skip to content

Instantly share code, notes, and snippets.

@anveo
Created August 4, 2011 22:03
Show Gist options
  • Save anveo/1126412 to your computer and use it in GitHub Desktop.
Save anveo/1126412 to your computer and use it in GitHub Desktop.
Reset logs
cat /dev/null > /var/www/api/shared/log/god.log
cat /dev/null > /var/www/api/shared/log/nginx_access.log
cat /dev/null > /var/www/api/shared/log/unicorn.stderr.log
cat /dev/null > /var/www/api/shared/log/unicorn.stdout.log
cat /dev/null > /var/www/api/shared/log/resque.log
cat /dev/null > /var/www/api/shared/log/production.log
# resync logs
kill -s USR1 `ps -ef | sed -n '/unicorn_rails master/{/grep/!p;}' | awk '{print$2}'`
kill -s HUP `ps -ef | sed -n '/resque:scheduler/{/grep/!p;}' | awk '{print$2}'`
# everything else???
for logs in `find /var/log -type f`; do > $logs; done
find /var/log -type f -name "*.gz" |xargs rm -f
find /var/log -type f -name "*.1" |xargs rm -f
find /var/log -type f -name "*.0" |xargs rm -f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment