Shell programming notes for running multiple applications in a single file

Source: Internet
Author: User
Open_file.sh: runs liferay, jira, confluence, bamboo, and fisheye sequentially. It can be run individually to check whether a program is running #! /Bin/sh # openfile: liferay, jira, confluence, bamboo, fisheye # portrunningpor

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

# Open file: liferay, jira, confluence, bamboo, fisheye

# Port running

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

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

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

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

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

# Open liferay

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

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

Echo "======================== liferay is runing! ========================"

Else

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

Sh startup. sh

Else

Echo "w4u.com. au" | sudo sh startup. sh

Fi

Wait

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

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

Echo "======================== liferay run failed! Exit open file =========================="

Echo "====================== jira, confluence, bamboo, fisheye no start! ========================"

Exit

Fi

Fi

# Open jira

Cd/usr/local/atlassian/jira/bin

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

Echo "======================= jira is runing! ======================"

Else

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

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

Echo "========================= clean jira cache complete! ======================"

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

Sh start-jira.sh

Else

Echo "w4u.com. au" | sudo sh start-jira.sh

Fi

Wait

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

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

Echo "======================= jira run failed! Exit open file =========================="

Echo "====================== confluence, bamboo, fisheye no start! ========================"

Exit

Fi

Fi

# Open confluence

Cd/usr/local/atlassian/confluence/bin

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

Echo "======================== confluence is runing! ======================"

Else

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

Sh startup. sh

Else

Echo "w4u.com. au" | sudo sh startup. sh

Fi

Wait

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

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

Echo "======================= confluence run failed! Exit open file =========================="

Echo "========================= bamboo, fisheye no start! ========================"

Exit

Fi

Fi

# Open bamboo

Cd/usr/local/atlassian/bamboo

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

Echo "========================= bamboo is runing! ======================"

Else

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

Sh bamboo. sh start

Else

Echo "w4u.com. au" | sudo sh bamboo. sh start

Fi

Wait

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

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

Echo "========================= bamboo run failed! Exit open file =========================="

Echo "======================== fisheye no start! ========================"

Exit

Fi

Fi

# Open fisheye

Cd/usr/local/atlassian/fecru/bin

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

Echo "======================== fisheye is runing! ======================"

Else

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

Sh start. sh

Else

Echo "w4u.com. au" | sudo sh start. sh

Fi

Wait

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

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

Echo "======================== fisheye run failed! Exit open file =========================="

Exit

Fi

Fi

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.