The script does not work anymore. Remote logon can work again ~! Solution

Source: Internet
Author: User
The script does not work anymore. Remote logon can work again ~! Solution-general Linux technology-Linux technology and application information. For more information, see the following. I want to maintain a server and write a server restart script .. The content is as follows:
#! /Bin/sh
#---------------------------------------
PRO = load_test
TestFunc ()
{
PROCESS_NUM = 'ps-ef | grep $ PRO | grep-v "grep" | wc-l'
Echo "------------- GET $ PRO num = $ PROCESS_NUM"
If [$ PROCESS_NUM-eq 0]; then
Echo "---------- return 0"
Return 0
Else
Echo "---------- return 1"
Return 1
Fi

}
Echo "++"
While [1]; do
TestFunc
TESTRET = $?
Echo "return the value is $ TESTRET"
# Killall-9 testq 0]; then
Echo "$ PRO is starting now ......"
./$ PRO &
Else
Echo "$ PRO is Running now ......."
Fi
Sleep 5
Done


The following problems are encountered:
Because the server runs in a remote linux (ubuntu .. I put this script in the same directory of the executable program. Normally, when load_test dump is completed, the script can be restarted normally.
But several times, load_test dump, and the script has not restarted the program. I want to log on remotely to see what is going on. When I log on successfully, load_test restarts again ..

The above phenomenon seems to me that my script is sleep while running in the background, and I have activated the script again when I log on...
This is a strange phenomenon. I don't know the specific reason. Please advise me !!
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.