Shell programming notes for running multiple applications in a single file

Source: Internet
Author: User

Open_file.sh:

Run liferay, jira, confluence, bamboo, and fisheye in sequence. You can run liferay, jira, confluence, bamboo, and fisheye individually to check whether a program has been run.

#! /Bin/sh

# Openfile: liferay, jira, confluence, bamboo, fisheye

# Portrunning

Port_l = 'netstat-an | grepLISTEN | grep: 8080'

Port_j = 'netstat-an | grepLISTEN | grep: 8080'

Port_c = 'netstat-an | grepLISTEN | grep: 8080'

Port_ B = 'netstat-an | grepLISTEN | grep: 8080'

Port_f = 'netstat-an | grepLISTEN | grep: 8080'

# Openliferay

Cd, usr, local, atlassian, liferay, tomcat-7.0.27, and bin

If ["$ port_l "! = ""]; Then

Echo "======================== liferayisruning! ========================"

Else

If [$ (whoami) = "root"]; then

Shstartup. sh

Else

Echo "w4u.com. au" | sudoshstartup. sh

Fi

Wait

Port_ll = 'netstat-an | grepLISTEN | grep: 8080'

If ["$ port_ll" = ""]; then

Echo "======================== liferayrunfailed! Exitopenfile =========================="

Echo "====================== jira, confluence, bamboo, fisheyenostart! ========================"

Exit

Fi

Fi

# Openjira

Cd/usr/local/atlassian/jira/bin

If ["$ port_j "! = ""]; Then

Echo "======================== jiraisruning! ======================"

Else

If [$ (whoami) = "root"]; then

Rm-rf/var/atlassian/application-data/jira/plugins/. osgi-plugins/felix-cache

Echo "======================== cleanjiracachecomplete! ======================"

Rm/var/atlassian/APP-data/jira/. jira-home.lock

Shstart-jira.sh

Else

Echo "w4u.com. au" | sudoshstart-jira.sh

Fi

Wait

Port_jj = 'netstat-an | grepLISTEN | grep: 8080'

If ["$ port_jj" = ""]; then

Echo "========================= jirarunfailed! Exitopenfile =========================="

Echo "====================== confluence, bamboo, fisheyenostart! ========================"

Exit

Fi

Fi

# Openconfluence

Cd/usr/local/atlassian/confluence/bin

If ["$ port_c "! = ""]; Then

Echo "======================== confluenceisruning! ======================"

Else

If [$ (whoami) = "root"]; then

Shstartup. sh

Else

Echo "w4u.com. au" | sudoshstartup. sh

Fi

Wait

Port_cc = 'netstat-an | grepLISTEN | grep: 8080'

If ["$ port_cc" = ""]; then

Echo "======================= confluencerunfailed! Exitopenfile =========================="

Echo "======================== bamboo, fisheyenostart! ========================"

Exit

Fi

Fi

# Openbamboo

Cd/usr/local/atlassian/bamboo

If ["$ port_ B "! = ""]; Then

Echo "========================= bambooisruning! ======================"

Else

If [$ (whoami) = "root"]; then

Shbamboo. shstart

Else

Echo "w4u.com. au" | sudoshbamboo. shstart

Fi

Wait

Port_bb = 'netstat-an | grepLISTEN | grep: 8080'

If ["$ port_bb" = ""]; then

Echo "========================= bamboorunfailed! Exitopenfile =========================="

Echo "======================== fisheyenostart! ========================"

Exit

Fi

Fi

# Openfisheye

Cd/usr/local/atlassian/fecru/bin

If ["$ port_f "! = ""]; Then

Echo "======================== fisheyeisruning! ======================"

Else

If [$ (whoami) = "root"]; then

Shstart. sh

Else

Echo "w4u.com. au" | sudoshstart. sh

Fi

Wait

Port_ff = 'netstat-an | grepLISTEN | grep: 8080'

If ["$ port_ff" = ""]; then

Echo "======================== fisheyerunfailed! Exitopenfile =========================="

Exit

Fi

Fi

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.