首页 > 其他 > 详细

自定义服务

时间:2020-07-10 13:23:22      阅读:61      评论:0      收藏:0      [点我收藏+]

linux自定义服务并设置开机自启动

【init.d】

服务脚本

#!/bin/sh
#chkconfig: 2345 80 05
#description: api-server

start() {
	nohup java -jar ./
}

stop() {
		
}

status() {
	`ps -ef|grep `
}

case $1 in 
start)
	start
	;;
stop)
	stop
	;;
restart)
	stop
	sleep 1
	start
	;;
*) 
	echo "api-server Usage:"
	echo "service api-server start | stop | restart | status"
	;;

服务添加

mv api-server /etc/init.id/

chkconfig --list //查看服务
chkconfig --add api-server //添加服务

服务启动

service api-server status
service api-server start
service api-server stop

自定义服务

原文:https://www.cnblogs.com/pengsn/p/13278636.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!