Skip to content

Instantly share code, notes, and snippets.

@jlamoree
Created May 7, 2013 17:52
Show Gist options
  • Save jlamoree/5534636 to your computer and use it in GitHub Desktop.
Save jlamoree/5534636 to your computer and use it in GitHub Desktop.
Check to see if a process is running in a Linux shell.
PID=`cat /var/run/something.pid`
kill -s 0 $PID 2>&1 > /dev/null
if [ $? == 0 ]; then
echo "Yes, it's running"
else
echo "Nope, it's dead"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment