Created
January 7, 2013 21:33
-
-
Save martinisoft/4478666 to your computer and use it in GitHub Desktop.
Pidcheck script
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
| #!/usr/bin/env bash | |
| function is_process_alive { | |
| set +e | |
| if [ -n $1 ] && kill -0 $1 >/dev/null 2>&1; then | |
| echo "yes" | |
| fi | |
| set -e | |
| } | |
| CUR_PID=$(cat /srv/service.pid) | |
| while [ -n "$(is_process_alive $CUR_PID)" ]; do | |
| /bin/echo -n '.' | |
| sleep 2 | |
| done | |
| echo "Process terminated" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment