码迷,mamicode.com
首页 > 系统相关 > 详细

Linux的启动脚本

时间:2019-01-11 17:16:42      阅读:166      评论:0      收藏:0      [点我收藏+]

标签:val   kconfig   sage   rc.d   mon   pre   cal   nginx   name   

#!/bin/bash
# nginx Startup script for the Nginx HTTP Server
# it is v.0.0.2 version.
# chkconfig: - 85 15
# description: Nginx is a high-performance web and proxy server.
# It has a lot of features, but its not for everyone.
# processname: nginx
nginx_sbin=/usr/local/nginx/sbin/nginx
nginx_config=/usr/local/nginx/conf/nginx.conf
nginx_pid=/var/run/nginx.pid
RETVAL=0
#source function library
. /etc/rc.d/init.d/functions

#source networking 
. /etc/sysconfig/network
[ -x ${nginx_sbin} ] ||  exit 0

#starting nginx server
start(){
    echo -n "starting nginx..."
    daemon  ${nginx_sbin} -c ${nginx_config}
    RETVAL=$?
    echo
    [ $RETVAL = 0 ] && touch /var/run/nginx_lock
    return $RETVAL
  
}

stop() {

  echo -e "Stopping nginx....."
  killproc ${nginx_sbin}
  RETVAL=$?
  [ $RETVAL = 0 ] && rm -f /var/run/nginx_lock 
}

restart() {
    stop
    sleep 5
    start
}
  
  
case $1 in 
  start)
    start
    ;;
  stop)
    stop
    ;;
  restart)
     restart
     ;;
   *)
    echo $"Usage: nginx {start|stop|restart}"
    exit
esac

 

Linux的启动脚本

标签:val   kconfig   sage   rc.d   mon   pre   cal   nginx   name   

原文地址:https://www.cnblogs.com/fengyongtao/p/10255595.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!