# Set the dump file size limit. Ulimit-C unlimitedcd/home/linbc/build/bin # Check whether the dump Folder does not exist. If [! -D ../dumpfile] Then ECHO "Create dumpfile fold" Mkdir ../dumpfilefi # Search
My
_ App1: whether it exists (we cannot restart this process every time. For example, in my scenario, I will continue to start the app1 process if it exists) If [-Z 'pgrep
My
_ App1'] Then ECHO "My_app1 not running! " Exitfi # Check whether my_app2 exists. If it does not exist, start If [-Z 'pgrep my_app2'] Then ECHO "My_app2 not running! " # Back up the dump file. I have created a folder in this path to store the dump file. App2_pid = 'Tail-1 ../dumpfile/app2.pid' If [-N $ app2_pid-a-e "Core. $ {app2_pid }" ] Then ECHO "Backup dumpfile, move core. $ {app2_pid} ../dumpfile/centd. Core. $ {app2_pid }" MV "Core. $ {app2_pid }" "../Dumpfile/app2.core. $ {app2_pid }" FI echo "Start the app2 server" Nohup./my_app2-C my_app2.conf> _ app2.out 2> & 1 & # Save the process number to rename the dump file Pgrep my_app2> ../dumpfile/app2.pidficd $ {oldpwd}
Then you can
Crontab-e
Write
0-59/5 ****/home/linbc/bin/check_the_process
Check every five minutes