centos 创建service,centosservice345为运行的级别


#!/bin/bash

#chkconfig: 345 99 6

#description: Startup Script for nexus

#/etc/init.d/nexus

exportJAVA_HOME=/media/mySave/mySave/backup/centos/usr/lib/Java/jdk1.7.0_71

exportJRE_HOME=${JAVA_HOME}/jre

exportCLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib

exportPATH=${JAVA_HOME}/bin:$PATH

exportRUN_AS_USER=root

case"$1" in

start)

/media/soft/studyTool/server/maven/nexus-2.14.0-01/nexus-2.14.0-01/bin/nexusstart > /home/kkihpl/service-nexus.log

echo"OK"

;;

stop)

/media/soft/studyTool/server/maven/nexus-2.14.0-01/nexus-2.14.0-01/bin/nexusstop > /home/kkihpl/service-nexus-stop.log

echo"OK"

;;

*)

echo"Usage:'basename $0'start|stop"

exit1

esac

exit0

chmod+x/etc/rc.d/init.d/nexus

#chkconfig: 345 99 6

为必要有的

#/etc/init.d/nexus

为存放的路径

注意#chkconfig: 345 99 99的含义表示支持chkconfig,开始运行的顺序为99,关闭顺序为6,(注意这两个参数必要为两位)。345为运行的级别。

注意#chkconfig: 345 99 6这几个数字之间的关糸

chkconfig--add nexus

chkconfignexus on

执行chkconfig--add后会在相当于自动执行如下语句添加连接

#ln-s /etc/init.d/nexus /etc/rc.d/rc3.d/S99nexus


#ln -s/etc/init.d/nexus /etc/rc.d/rc4.d/S99nexus


#ln -s/etc/init.d/nexus /etc/rc.d/rc5.d/S99nexus


chkconfig--level 35 httpd on将Level3和Level5设置成on

后再执行chkconfig--add nexus,这样文件中可以没有

”中的等级选项


相关内容

    暂无相关文章