码迷,mamicode.com
首页 > 其他好文 > 详细

自定义服务

时间:2020-07-10 13:32:25      阅读:70      评论:0      收藏:0      [点我收藏+]

标签:开机   esc   stat   bin   desc   服务脚本   服务   script   cas   

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

自定义服务

标签:开机   esc   stat   bin   desc   服务脚本   服务   script   cas   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!