在linux下启动resin

一,配置开机启动的方式:

vi /etc/rc.local

 

添加如下
export JAVA_HOME=/usr/local/jrockit-jdk1.6.0_31-R28.2.3-4.1.0
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$JAVA_HOME/bin:$PATH
sh /usr/local/resin-pro-3.1.6/bin/start

 不过在这里配置resin是用root 的权限开启resin有不安因素

 

二,安装服务的方式:

第一种方式:

在/etc/init.d/下添加一个启动脚本

#vi resin.sh

 

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/sh
#chkconfig:345 99 10
#description:auto start resin
#/etc/init.d/resin.sh
export export JAVA_HOME= /usr/java/jdk1 .7
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/local/resin/bin/httpd .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

保存退出

#chmod u+x resin.sh

#chkconfig --add resin.sh

#service resin.sh start 启动

#service resin.sh stop 关闭

 

第二种方法:

# vi /usr/local/resin/bin/httpd.sh

把原来

Java代码   

?
1
2
3
4
5
if test -n "${JAVA_HOME}" ; then
   if test -z "${JAVA_EXE}" ; then
     JAVA_EXE=$JAVA_HOME /bin/java
   fi
fi

改为

Java代码   

?
1
2
3
4
5
6
7
if test -n "${JAVA_HOME}" ; then
   if test -z "${JAVA_EXE}" ; then
     JAVA_EXE=$JAVA_HOME /bin/java
   fi
else
     JAVA_EXE=<span>< /span > /usr/java/jdk1 .7 /bin/java
fi

保存退出

#切换到

/etc/init.d 下面

#ln -s /usr/local/resin/bin/httpd.sh httpd

#chmod u+x httpd

#chkconfig --add httpd

#service httpd start 启动

#service httpd stop 关闭

删除默认启动用 chkconfig --del httpd

你可能感兴趣的:(linux)