执行前提:
1.在/usr/local/sentinel/目录下添加sentinel-dashboard-1.8.3.jar
2.创建/data/logs/sentinel目录
3.执行chmod +x /usr/local/sentinel/sentinel-dashboard-1.8.3.jar添加权限
#!/bin/bash
#
# chkconfig: 2345 10 90
#
# description:auto_run
##### 上面这三行注释的代码必须添加 上面的注释的意思是,sentinel服务必须在运行级2,3,4,5下被启动或关闭,启动的优先级是90,关闭的优先级是10。
#程序名
RUN_NAME="sentinel-dashboard"
#资源位置
JAVA_OPTS=/usr/local/sentinel/sentinel-dashboard-1.8.3.jar
#日志位置
LOG_DIR=/data/logs/sentinel
LOG_FILE=$LOG_DIR/sentinel-dashboard.log
LOG_OPTS=$LOG_DIR/sentinel_temp.log
#开始方法
start() {
source /etc/profile;
nohup java -Xms256M -Xmx512M -XX:PermSize=128M -XX:MaxPermSize=256M -Dcsp.sentinel.log.dir=$LOG_DIR -Dlogging.file=$LOG_FILE -Dserver.port=29000 -Dcsp.sentinel.dashboard.server=127.0.0.1:29000 -Dproject.name=Sentinel-Dashboard -jar $JAVA_OPTS >$LOG_OPTS 2>&1 &
echo "$RUN_NAME started success..."
}
#结束方法
stop() {
echo "stopping $RUN_NAME ..."
kill -9 `ps -ef|grep $JAVA_OPTS|grep -v grep|grep -v stop|awk '{print $2}'`
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
*)
echo "Userage: $0 {start|stop|restart}"
exit 1
esac
执行后:
chkconfig --add /etc/rc.d/init.d/sentinel # 添加自定义服务
chkconfig sentinel on # 自定义服务开机启动
systemctl daemon-reload # 刷新
systemctl start sentinel # 启动sentinel
netstat -ntlp #查看端口启动情况
ps -ef|grep sentinel # 查看启动情况
评论 (0)