The two-day project online
I've been busy.
Three days overtime.
But there's still a harvest.
Premise:
When you write the startup script start.sh, cycle to start the change process
While True
Java-jar Xxx.jar
Done
When starting, of course, start the command in the background
Nohup start.sh &
At this point, if you want to turn off the change script, what do you do now?
Had to Ps-ef|grep start.sh
and kill this thread.
This is very troublesome and unsafe, in case you kill someone else's thread, that ...
Then write a stop script.
When thinking:
When you start the script, touch a file Start.flag
Before each cycle after starting to determine whether there are stop.flag
If it does, the stop script has started
Stops the loop and deletes the Start.flag
In the Stop script, first determine if there is a Start.flag
If there is a start.flag, create the Stop.flag
If there is no Start.flag, the startup script is not running
If you determine that Start.flag has been deleted, the startup program has stopped and deleted Stop.flag
Done