Linux care process Script 1. Care Process script. The working principle is to use shell to constantly query the process. If the process does not exist, start the process. If you start with gnome, you need to start the script on the GUI. Start. sh Js Code #! /Bin/bash # program directory path PRO_PATH = "/opt/bin/" # program name PRO_NAME = "Record" # program path, not need configure. PRO_MAIN = $ PRO_PATH $ PRO_NAME # GNOME start program, not need configure. PROGRAM_GNOME = "gnome-terminal-e \" $ PRO_MAIN \ "" # start method GNOME or nohup (eg: GNONE --> STAR_PRO = $ PROGRAM_GNOME; nohup --> STAR_METHOD = $ PRO_MAIN) STAR_METHOD = $ PROGRAM_GNOME while true; do PRO_NOW = 'ps aux | Grep $ PRO_NAME | grep-v grep | wc-l 'if [$ PRO_NOW-lt 1]; then $ STAR_METHOD 2>/dev/null 1> & 2 & date> $ PRO_PATH/tinfo. log echo "------------------ $ PRO_MAIN start --------------------"> $ PRO_PATH/tinfo. log fi sleep 10 done exit 0 2. start the process script. If start. sh is directly started on the client, the program started on the client will die. After the process is started, the client is turned off and the process still exists. Bhstart. shJs Code #! /Bin/bash./start. sh & 3. Close the startup process script. Bhstop. shJava Code #! /Bin/bash # progress name PRO_NAME = "Record" ps-ef | grep $ PRO_NAME | grep-v grep | awk '{print $3}' | xargs kill echo "kill start. sh done! "Ps-ef | grep $ PRO_NAME | grep-v grep | awk '{print $2}' | xargs kill echo" kill $ PRO_NAME done"