Here's a Challenge to all you boffins out there. Here's my issue:
I've got a Linux machine running 2 Scripts. 1 Script runs commands that affect the second script. The second script runs programs in a loop.
E.g. Script 1 - stop script 2 Script 1 - start script 2 This is in the form of service Script2 start / service Script2 stop. etc. *Note that service Script2 start creates a new detached screen with the second script.
The second script runs in a loop like:
- Run Update Script & Wait
- Run First Game & Wait
- Run Second Game & Wait
The games tend to run in their own screens, so when they are killed, the main script isn't. So if the game crashes, the Script2 doesn't crash.
Here's where the problem lies. I need to make it so that when I want to stop the server, it must first kill the game safely, e.g. allow time for it to shutdown. Then kill the Script2 screen and prevent the loop from starting the game again.