Skip to content

Instantly share code, notes, and snippets.

@shanemhansen
Created July 18, 2014 17:29
Show Gist options
  • Save shanemhansen/b4b2a9a92fdacf2798d8 to your computer and use it in GitHub Desktop.
Save shanemhansen/b4b2a9a92fdacf2798d8 to your computer and use it in GitHub Desktop.
watch deamonize
#!/bin/bash
PIDFILE="na.pid"
nohup ./netacuity_server "$1" &
sleep 1
while test -e "$PIDFILE" ; do
if kill -0 $(cat $PIDFILE) 2>/dev/null; then
continue
else
echo "graceful shutdown"
exit
fi
sleep 1
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment