linux中resin啟動shell指令碼

來源:互聯網
上載者:User

代碼如下

 代碼如下 複製代碼

[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
 
do
 
        $StartPath -server $id $1 >>$ResinLog/resin_startup.log
 
        if [ $? -eq 0 ]
 
                then
 
                        action "resin is $1......" /bin/true
 
                else
 
                        action "resin is $1....." /bin/false
 
                fi
 
done
 
 
 
 
 
}
 
 
 
case "$1" in
 
        start)
 
                resind $1
 
                sleep 10
 
                ;;
 
        stop)
 
                resind $1
 
                ;;
 
        restart)
 
                resind stop
 
                resind start
 
                ;;
 
        *)
 
                echo "Usage:$0 {status|start|stop|restart}"
 
                exit 1
 
esac
 
exit 0


提示:ressin 3.1可用,4.0待測試,其中,teddylu 是一個伺服器的id,即一個執行個體,如果有多個,可以依次列出,如 teddylu duncan

補充:經過我的測試,該指令碼也同樣適用於resin4.0

 

 代碼如下 複製代碼

 

#!/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

do

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

if [ $? -eq 0 ]

then

action “resin is $1……” /bin/true

else

action “resin is $1…..” /bin/false

fi

done

 

 

}

 

case “$1” in

start)

resind $1

sleep 10

;;

stop)

resind $1

;;

restart)

resind stop

resind start

;;

*)

echo “Usage:$0 {start|stop|restart}”

exit 1

esac

exit 0

 

提示:與3.1不同的就是,4.0的官方內建的啟動指令碼的名字變了

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.