舉個栗子: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