Linux Resin launch shell script

Source: Internet
Author: User
Tags sleep

The code is as follows

The code is as follows Copy Code

[Root@client01 ~]# Cat/etc/init.d/resind

#!/bin/sh



#created by Teddylu at 2014-12-12

#used to startup for resin version 3.1

#chkconfig: 345 85 15


#set up environment variable to fix the failure of resin automatical startup for Chkconfig
Export JAVA_HOME=/APPLICATION/JDK
Export classpath= $CLASSPATH: $JAVA _home/lib: $JAVA _home/jre/lib
Export path= $JAVA _home/bin: $JAVA _home/jre/bin: $PATH: $HOME/bin

. /etc/init.d/functions

Startpath= '/application/resin/bin/httpd.sh '

resinlog=/app/resin/logs/

[!-D $ResinLog] && makedir-p $ResinLog



Resind ()



{

For ID in Teddylu

Todo

$StartPath-server $id $ >> $ResinLog/resin_startup.log

If [$?-eq 0]

Then

Action "Resin is $ ..."/bin/true

Else

Action ' resin is $ ... '/bin/false

Fi

Done





}



Case "$" in

Start

Resind $

Sleep 10

;;

Stop

Resind $

;;

Restart)

Resind stop

Resind start

;;

*)

echo "usage:$0 {Status|start|stop|restart}"

Exit 1

Esac

Exit 0


Tip: Ressin 3.1 available, 4.0 to be tested, where Teddylu is a server ID, an instance, if there are multiple, can be listed in sequence, such as Teddylu Duncan

Add: After my test, the script also applies to resin4.0

The code is as follows Copy Code

#!/bin/sh

#created by Teddylu at 2014-12-12

#used to startup for resin version 4.0

#chkconfig: 345 85 15

#set up environment variable to fix the failure of resin automatical startup for Chkconfig

Export JAVA_HOME=/APPLICATION/JDK

Export classpath= $CLASSPATH: $JAVA _home/lib: $JAVA _home/jre/lib

Export path= $JAVA _home/bin: $JAVA _home/jre/bin: $PATH: $HOME/bin

. /etc/init.d/functions

Startpath= '/application/resin/bin/resin.sh '

resinlog=/app/resin/logs/

[!-D $ResinLog] && makedir-p $ResinLog

Resind ()

{

For ID in Oldboy

Todo

$StartPath-server $id $ >> $ResinLog/resin_startup.log

If [$?-eq 0]

Then

Action "Resin is $ ..."/bin/true

Else

Action ' resin is $ ... '/bin/false

Fi

Done

}

Case "$" in

Start

Resind $

Sleep 10

;;

Stop

Resind $

;;

Restart)

Resind stop

Resind start

;;

*)

echo "usage:$0 {Start|stop|restart}"

Exit 1

Esac

Exit 0

Tip: Unlike 3.1, 4.0 of the official built-in startup script name has changed

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.