文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>How to RedHat Linux init script

How to RedHat Linux init script

时间:2006-06-30  来源:pianoch

1. RedHat Linux use chkconfig command to configure init script.
  #chkconfig --list list all of initscript services.   #chkconfig <service-name> on #chkconfig <service-name> off <service-name>: the script name on /etc/init.d These two command does not start/stop service actuallly, these just tell the system, these service will be started/stoped on next system reboot.  
2. Use service command start/stop service manually 
service <service-name> start service <service-name> stop      
3. Difference with ordinary system V init script
See the example below, pay attension to   #chkconfig: 35 90 12 let chkconfig know: 35: run level 90: start priority 12: stop priority   lock file is necessary.   #!/bin/bash
#
# chkconfig: 35 90 12
# description: My server
#

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

start() {
        initlog -c "echo -n Starting my server: "
        /path/to/servicename &
    ### touch the lock file ###
        touch /var/lock/subsys/servicename
        success $"My server startup"
        echo
}

stop() {
        initlog -c "echo -n Stopping my server: "
        killproc servicename
    ### Remove the lock file ###
        rm -f /var/lock/subsys/servicename
        echo
}

case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  status)
        status servicename
        ;;
  restart|reload|condrestart)
        stop
        start
        ;;
  *)
        echo $"Usage: $0 {start|stop|restart|reload|status}"
        exit 1
esac
 
exit 0
     
相关阅读 更多 +
排行榜 更多 +
我狙击打的贼准

我狙击打的贼准

飞行射击 下载
暗夜编年史

暗夜编年史

飞行射击 下载
狙击先生子弹行动

狙击先生子弹行动

飞行射击 下载