Skip to content

Instantly share code, notes, and snippets.

@zeevallin
Last active December 18, 2015 16:39
Show Gist options
  • Save zeevallin/5812761 to your computer and use it in GitHub Desktop.
Save zeevallin/5812761 to your computer and use it in GitHub Desktop.
is_running() {
[ -f $1 ] || return 1
read PID < $1
[ -d /proc/${PID} ] || return 1
return 0
}
if is_running "/var/run/app.pid/"; then
echo "running"
else
echo "not running"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment