Skip to content

Instantly share code, notes, and snippets.

@Izumemori
Last active February 24, 2020 20:28
Show Gist options
  • Save Izumemori/c79c2bf37fcfcda2e924dc2b11bbda8b to your computer and use it in GitHub Desktop.
Save Izumemori/c79c2bf37fcfcda2e924dc2b11bbda8b to your computer and use it in GitHub Desktop.
Your watcher script is bad hold mine
#!/bin/bash
QUIT_EXIT_CODE=1
COMMAND=$@
for (( ;; ))
do
$COMMAND
EXIT_CODE=$?
if [ $EXIT_CODE == $QUIT_EXIT_CODE ]
then
echo "Exiting..."
break
fi
echo "Application exited with exit code $EXIT_CODE, restarting..."
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment