使用service启动服务,并且设置开机启动
导读
编写脚本jdms
chmod 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
现在是开机启动了,可以重启看看是否运行了
猜你喜欢
评论(0)


