Guest User

Untitled

a guest
Nov 24th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. #!/bin/bash -e
  2. cd ~/live
  3.  
  4. sidekiq_pid=`ps aux | grep sidekiq | grep -v grep | awk '{print $2}'`
  5. puma_pid=`ps aux | grep puma | grep -v grep | awk '{print $2}'`
  6.  
  7. /home/mastodon/.rbenv/shims/bundle exec rbtrace -p $puma_pid --timeout 30 -e 'Thread.new{GC.start;require "objspace";io=File.open("/tmp/puma.dump", "w"); ObjectSpace.dump_all(output: io); io.close}'
  8. /home/mastodon/.rbenv/shims/bundle exec rbtrace -p $sidekiq_pid --timeout 30 -e 'Thread.new{GC.start;require "objspace";io=File.open("/tmp/sidekiq.dump", "w"); ObjectSpace.dump_all(output: io); io.close}'
  9.  
  10. # ちょっと待つと吉
  11. sleep 5
  12.  
  13. rm /tmp/dump.tar.gz
  14. tar -zcf /tmp/dump.tar.gz /tmp/puma.dump /tmp/sidekiq.dump
  15. rm /tmp/*.dump
Add Comment
Please, Sign In to add comment