* 这里能够是任意编程语言(C、C++、Java、PHP、Python、Perl ...)编写的程序;编程
当前假设此程序的执行目录为:bash
/myservice/bin
#! /bin/bash # chkconfig: 2345 80 90 # description: this is your auto run program. start() { echo "starting service ..." cd /myservice/bin ./start.sh echo "ok" } stop() { echo "stop service ..." cd /myservice/bin ./stop.sh echo "ok" } case "$1" in "start") start ;; "stop") stop ;; "restart") stop start ;; *) echo $"Usage: $0 {start|stop|restart}" exit 0 esac
* 请注意检查脚本的前面,是否有完整的两行编程语言
#chkconfig: 2345 80 90
#description: this is your auto run program.
chkconfig --add myservice chkconfig --level 2345 myservice on
chkconfig --list [name] chkconfig --add name chkconfig --del name chkconfig [--level levels] name <on|off|reset> chkconfig [--level levels] name