Determine if the process is not present

Source: Internet
Author: User
Tags jboss

#!/bin/bash
#

#调用关闭jboss进程脚本
stopmethodserver.sh

#打印出当前的jboss进程: The JBoss process of grep jboss query, grep-v "grep" to remove the grep process
Jmsthread= ' Ps-ef | grep Gdms | grep JBoss | Grep-v "grep"
Echo $jmsThread

#查询jboss进程个数: wc-l number of rows returned
Count= ' Ps-ef | grep Gdms | grep JBoss | Grep-v "grep" | Wc-l '
Echo $count

Sec=7
#开始一个循环 to determine if the process is closed

for Var in 1 2
Do
If [$count-gt 0]; Then
#若进程还未关闭, the script will sleep for a few seconds
echo Sleep $sec Second The $var time, the JMS thread is still alive
Sleep $sec
Else
#若进程已经关闭, you jump out of the loop
echo "Break"
Break
Fi
Done

#if [$count-eq 0]; Then
# echo "Nohup startmethodserver.sh &"
# Nohup Startmethodserver.sh &
#else
# echo "It ' s better to check the thread!!!"
#fi

#调用启动脚本
Nohup startmethodserver.sh &

Determine if the process is not present

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.