红联Linux门户
Linux帮助

linux通用启动脚本

发布时间:2007-11-20 11:09:34来源:红联作者:Boyswywh
供学习参考

引用:
#!/bin/sh

# Source function library.
. /etc/rc.d/init.d/functions

# See how we were called.
case "$1" in
start)
echo -n "Starting XXXXX: "
# daemon XXXXX
/usr/sbin/XXXXX start //启动服务程序的路径
echo " [ OK ]"
touch /var/lock/subsys/XXXXX
;;
stop)
echo -n "Shutting down XXXXX: "
killproc XXXXX
echo
rm -f /var/lock/subsys/XXXXX
rm -f /var/run/XXXXX.pid
;;
status)
status XXXXX
;;
restart)
$0 stop
$0 start
;;
reload)
echo -n "Reloading XXXXX: "
killproc XXXXX -HUP
echo
;;
*)
echo "Usage: $0 {start|stop|restart|reload|status}"
exit 1
esac

exit 0


注:XXXXX是服务名称。
文章评论

共有 1 条评论

  1. 天明 于 2007-12-25 16:43:50发表:

    :0wl;l1 看不懂。