Skip to content

Instantly share code, notes, and snippets.

@pen
Last active October 31, 2017 01:51
Show Gist options
  • Save pen/76565ac5c80e052bb6953503de719481 to your computer and use it in GitHub Desktop.
Save pen/76565ac5c80e052bb6953503de719481 to your computer and use it in GitHub Desktop.
中身が間違ってるPIDファイルを消す
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