Last active
August 29, 2015 14:24
-
-
Save shadowbq/01987b0d01194ab5fa74 to your computer and use it in GitHub Desktop.
find and kill all old worker.rb and restart in context
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Ubuntu tested 14.04.2 | |
# root@downloader:/usr/local/www/ydl# ps -U www-data -u www-data ajf |grep 'worker.rb' |grep -v 'grep' | |
# 1 10193 10185 1320 pts/0 10440 Sl 33 0:00 ruby ./worker.rb | |
# 1 10163 10155 1320 pts/0 10440 Sl 33 0:00 ruby ./worker.rb | |
echo 'killing old proc' | |
ps -U www-data -u www-data ajf |grep 'worker.rb' |grep -v grep | awk -F ' ' '{print $3}'| xargs -I {} kill -9 -{} | |
echo 'starting worker' | |
sudo -u www-data sh -c 'nohup ./worker.rb >> logs/worker.log &' | |
echo 'done.' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment