linux添加service服务,设置自启


举个栗子:idea的注册服务
位置及文件:/etc/init.d/idea
idea

#!/bin/sh
# chkconfig: 2345 80 90
# description: idea register server

case "$1" in
        start)
                sh /usr/local/idea/start.sh
        ;;
        stop)
                ps -ef |grep idea|grep -v grep|awk '{print $2}'|xargs kill
        ;;
esac

# chkconfig ,# description不要少,设置自启需要。

服务启动:service idea start
服务关闭:service idea shutdown
设置自启:chkconfig idea on
关闭自启:chkconfig idea off

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM