Last active
October 31, 2017 01:51
-
-
Save pen/76565ac5c80e052bb6953503de719481 to your computer and use it in GitHub Desktop.
中身が間違ってるPIDファイルを消す
This file contains 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
for pid_file in /var/run/*.pid; do | |
t=${pid_file##*/} | |
cmd=${t%.*} | |
pid=`cat $pid_file` | |
comm=/proc/$pid/comm | |
if [ -e $comm ]; then | |
if [ `cat $comm` == $cmd ]; then | |
continue | |
fi | |
fi | |
echo rm -f $pid_file | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment