nginx service can not auto start

Peter Portante peter.a.portante at gmail.com
Fri May 14 18:16:27 MSD 2010


Any output in log files for the service? Can you show how you start nginx by
hand and then how the script runs (set -x)?

-peter

On 5/14/10 9:58 AM, "wangyu1314" <nginx-forum at nginx.us> wrote:

> I am using nginx on redhat for a  very long time, I found a service script,
> installed nginx as a service to redhat, it is fine.
> but I found a bug, that after dirty shutdown,  nginx service can not auto
> start, and i only start it by hand.
> please help me, blow is the service script:
> 
> #!/bin/bash
> # nginx Startup script for the Nginx HTTP Server
> # this script create it by jackbillow at 2007.10.15.
> # it is v.0.0.2 version.
> # if you find any errors on this scripts,please contact jackbillow.
> # and send mail to jackbillow at gmail dot com.
> # chkconfig: - 85 15
> # description: Nginx is a high-performance web and proxy server.
> #              It has a lot of features, but it's not for everyone.
> # processname: nginx
> # pidfile: /usr/local/webserver/nginx/logs/nginx.pid
> # config: /usr/local/webserver/nginx/conf/nginx.conf
> 
> nginx=/usr/local/webserver/nginx/sbin/nginx
> nginx_config=/usr/local/webserver/nginx/conf/nginx.conf
> nginx_pid=/usr/local/webserver/nginx/logs/nginx.pid
> 
> RETVAL=0
> prog="nginx"
> 
> # Source function library.
> . /etc/rc.d/init.d/functions
> 
> # Source networking configuration.
> . /etc/sysconfig/network
> 
> # Check that networking is up.
> [ ${NETWORKING} = "no" ] && exit 0
> 
> [ -x $nginx ] || exit 0
> 
> 
> # Start nginx daemons functions.
> start() {
> 
> if [ -e $nginx_pid ];then
>    echo "nginx already running...."
>    exit 1
> fi
> 
>    echo -n $"Starting $prog: "
>    daemon $nginx -c ${nginx_config}
>    RETVAL=$?
>    echo
>    [ $RETVAL = 0 ] && touch /var/lock/subsys/nginx
>    return $RETVAL
> 
> }
> 
> 
> # Stop nginx daemons functions.
> stop() {
>         echo -n $"Stopping $prog: "
>         killproc $nginx
>         RETVAL=$?
>         echo
>         [ $RETVAL = 0 ] && rm -f /var/lock/subsys/nginx
> /usr/local/webserver/nginx/logs/nginx.pid
> }
> 
> 
> # reload nginx service functions.
> reload() {
> 
>     echo -n $"Reloading $prog: "
>     #kill -HUP `cat ${nginx_pid}`
>     killproc $nginx -HUP
>     RETVAL=$?
>     echo
> 
> }
> 
> # See how we were called.
> case "$1" in
> start)
>         start
>         ;;
> 
> stop)
>         stop
>         ;;
> 
> reload)
>         reload
>         ;;
> 
> restart)
>         stop
>         start
>         ;;
> 
> status)
>         status $prog
>         RETVAL=$?
>         ;;
> *)
>         echo $"Usage: $prog {start|stop|restart|reload|status|help}"
>         exit 1
> esac
> 
> exit $RETVAL
> 
> Posted at Nginx Forum: http://forum.nginx.org/read.php?2,86637,86637#msg-86637
> 
> 
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://nginx.org/mailman/listinfo/nginx





More information about the nginx mailing list