If the script returns the exit codes indicated in the answer by this link , then it should work. If you come back and read this answer again, it means you should not use kill . Using until will be checked for start because a failed start should return a non-zero exit code. Replace "myserver" with the name of your script.
Your script may have traps that handle various signals and other conditions. These trap handlers can set the appropriate exit codes.
Here is a demo. The subshell (echo "running 'dummy'"; sleep 2; exit $result) is standin for your script:
result=0 until (echo "running 'dummy'"; sleep 2; exit $result) do echo "Server 'dummy' crashed with exit code $?. Respawning.." >&2 sleep 1 done
Try to crash "dummy" by setting result=1 and running the until loop again.
source share