Linux resin自动启动设置

1、添加启动脚本

在   /etc/init.d   添加启动脚本
vi      resin

#!/bin/sh
#chkconfig:345 99 10
#description:auto start resin
#/etc/init.d/resin
export export JAVA_HOME=/usr/weaver/jdk1.8.0_151
export CLASSPATH=$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH:$HOME/bin
 
RETVAL=0
RESIN_PATH=/usr/weaver/Resin4/bin/startresin.sh
start()
{
        if [ -f $RESIN_PATH ];
        then
                echo $"Starting Resin"
                $RESIN_PATH start
                RETVAL=$?
                echo "OK"
                return $RETVAL
        fi
}
stop()
{
        if [ -f $RESIN_PATH ];
        then
                echo $"Stopping Resin"
                $RESIN_PATH stop
                RETVAL=$?
                sleep 1
                echo "OK"
                return $RETVAL
        fi
}
 
case "$1" in
start)
        start
        ;;
stop)
        stop
        ;;
restart)
        echo $"Restarting Resin"
        $0 stop
        sleep 1
        $0 start
        ;;
*)
echo $"Usage:$0{start|stop|restart}"
exit 1
;;
esac
exit $RETVAL

注意:(下面这几个参数需要根据自己的实际路径进行填写)

export export JAVA_HOME=/usr/weaver/jdk1.8.0_151
export CLASSPATH=$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH:$HOME/bin
 
RETVAL=0
RESIN_PATH=/usr/weaver/Resin4/bin/startresin.sh

2、创建完启动脚本后,需要对脚本进行授权

#chmod u+x resin

#chkconfig --add resin

#service resin start 启动

#service resin stop 关闭

你可能感兴趣的:(linux,运维,服务器)