I have a bash shell script that uses wait() to determine if an application exited. However, I am having a hard time killing the script/application when I want it to. The idea of the script is to restart the application if it dies or a software update needs to happen, but I need a backdoor or signal trap to be able to kill it without restarting the application.
The program will exit if it updates and then restart, it will also restart if the application exits no matter what. Which is what I need. However, I also need a special way to END this script ,without restarting the app, for special purposes
Here is the script:
# Initial Launch of the application /app & while true do PID=$! #process ID of app # The app background process uses exit(0) to possibly end. wait $PID if [ -f $FILE ]; then echo "Update successfully" mv appcp app chmod "+x" app /app & # restart else #error happened if file does not exist #restart /app & fi done