Skip to content

Instantly share code, notes, and snippets.

@martinisoft
Created January 7, 2013 21:33
Show Gist options
  • Select an option

  • Save martinisoft/4478666 to your computer and use it in GitHub Desktop.

Select an option

Save martinisoft/4478666 to your computer and use it in GitHub Desktop.
Pidcheck script
#!/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