日期:2014-05-16 浏览次数:20658 次
第一种方式:
在/etc/init.d/下添加一个启动脚本
#vi resin.sh
#!/bin/sh #chkconfig:345 99 10 #description:auto start resin #/etc/init.d/resin.sh export export JAVA_HOME=/usr/local/jrmc4 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
把原来
if test -n "${JAVA_HOME}"; then if test -z "${JAVA_EXE}"; then JAVA_EXE=$JAVA_HOME/bin/java fi fi
?改为
if test -n "${JAVA_HOME}"; then if test -z "${JAVA_EXE}"; then JAVA_EXE=$JAVA_HOME/bin/java fi else JAVA_EXE=/usr/local/jrmc4/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