Skip to content

Instantly share code, notes, and snippets.

@alepez
Created May 19, 2016 08:56
Show Gist options
  • Save alepez/f83a0887e21a6df94c39837042c911a8 to your computer and use it in GitHub Desktop.
Save alepez/f83a0887e21a6df94c39837042c911a8 to your computer and use it in GitHub Desktop.
detect process restart
while true; do sleep 1; npid="$( ps | grep Dia[g] | awk '{ print $1 }' )"; if [ "$npid" != "$pid" ]; then echo "$(date) crash detected"; fi;
pid=$npid; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment