使用service启动服务,并且设置开机启动
设置service启动服务,并且设置开机启动编写脚本jdmschmod 777 jdms
#! /bin/bash
#chkconfig: 35 85 15
#description: this is jdmsdeamon.
start() {
echo "start jdmsdeamon: "
/usr/local/jdms/bin/jdmsdeamon
echo "start success"
}
stop() {
echo "stop jdmsdeamon: "
killall jdmsdeamon
echo "stop jdms_umdeamon: "
killall jdms_umdeamon
echo "stop jdms_imdeamon: "
killall jdms_imdeamon
echo "stop success"
}
restart() {
stop
start
echo "restart success"
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
*)
echo $"Usage: $0 {start|stop|restart}"
exit 2
esac
保存后:chmod 777 jdms然后:cp jdms /etc/init.d/现在你可以使用service jdms start然后: chkconfig --add jdms现在是开机启动了,可以重启看看是否运行了