Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Watch for termination of spot instance, SIGHUP passed process if so.
echo "Watching for spot instance termination; will SIGHUP $pid if so."
while kill -0 $pid >/dev/null 2>/dev/null; do
if curl -s | grep -q .*T.*Z; then
echo 'oh noes! telling caffe to snapshot.'
kill -SIGHUP $pid
sleep 5;
echo "$pid ended, and we're still alive. Huzzah!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.