22 messages in ru.sysoev.nginxRe: Nginx w/ ssh restart
FromSent OnAttachments
Victor IggySep 10, 2008 3:12 pm 
Igor SysoevSep 10, 2008 10:09 pm 
Victor IggySep 11, 2008 3:52 pm 
Igor SysoevSep 13, 2008 7:06 am 
Victor IggySep 13, 2008 11:18 am 
Clint PriestSep 14, 2008 5:18 pm 
Igor SysoevSep 15, 2008 1:14 am 
Victor IggySep 15, 2008 5:21 pm 
Igor SysoevSep 16, 2008 1:42 am 
Clint PriestSep 16, 2008 9:16 pm 
Darrin ChandlerSep 16, 2008 9:51 pm 
Igor SysoevSep 16, 2008 10:34 pm 
Mansoor PeerbhoySep 16, 2008 11:17 pm 
Igor SysoevSep 16, 2008 11:21 pm 
Mansoor PeerbhoySep 16, 2008 11:26 pm 
mikeSep 16, 2008 11:29 pm 
Igor SysoevSep 16, 2008 11:41 pm 
Igor SysoevSep 16, 2008 11:51 pm 
mikeSep 17, 2008 12:16 am 
Clint PriestSep 17, 2008 5:28 pm 
Samuel VogelSep 17, 2008 5:43 pm 
mikeSep 17, 2008 5:46 pm 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: Nginx w/ ssh restartActions...
From:Igor Sysoev (is@rambler-co.ru)
Date:Sep 16, 2008 11:41:56 pm
List:ru.sysoev.nginx

On Tue, Sep 16, 2008 at 11:29:36PM -0700, mike wrote:

On Tue, Sep 16, 2008 at 10:35 PM, Igor Sysoev <is@rambler-co.ru> wrote:

The problem is probably in "service" utility. What is it ?

redhat style init

i install nginx on redhat using this:

cp /usr/src/build/extras/nginx.initd /etc/init.d/nginx /sbin/chkconfig --add nginx

then 'service' works properly

this is the nginx.initd script:

#!/bin/sh # # Init file for nginx # # chkconfig: 2345 55 25 # description: Nginx web server # # processname: nginx # config: /usr/local/nginx/nginx.conf # pidfile: /usr/local/nginx/nginx.pid

# Description: Startup script for nginx webserver on Debian. Place in /etc/init.d and # run 'sudo update-rc.d nginx defaults', or use the appropriate command on your # distro. For CentOS/Redhat run: '/sbin/chkconfig --add nginx' # # Author: Ryan Norbauer <ryan@gmail.com> # Modified: Geoffrey Grosenbach http://topfunky.com # Modified: David Krmpotic http://davidhq.com # Modified: Vishnu Gopal http://vish.in

set -e

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin DESC="nginx daemon" NAME=nginx DAEMON=/usr/sbin/nginx CONFIGFILE=/etc/nginx/nginx.conf PIDFILE=/var/run/nginx.pid SCRIPTNAME=/etc/init.d/nginx

# Gracefully exit if the package has been removed. test -x $DAEMON || exit 0

d_start() { $DAEMON -c $CONFIGFILE || echo -en "\n already running" }

d_stop() { kill -QUIT `cat $PIDFILE` || echo -en "\n not running" }

d_reload() { kill -HUP `cat $PIDFILE` || echo -en "\n can't reload" }

case "$1" in start) echo -n "Starting $DESC: $NAME" d_start echo "." ;; stop) echo -n "Stopping $DESC: $NAME" d_stop echo "." ;; reload) echo -n "Reloading $DESC configuration..." d_reload echo "." ;; restart) echo -n "Restarting $DESC: $NAME" d_stop # One second might not be time enough for a daemon to stop, # if this happens, d_start will fail (and dpkg will break if # the package is being upgraded). Change the timeout if needed # be, or change d_stop to have start-stop-daemon use --retry. # Notice that using --retry slows down the shutdown process somewhat. sleep 1 d_start echo "."

BTW, this restart may not work, because -QUIT is a graceful exit, and it may hang for long time, and new nginx will can not bind to listen sockets. It should be changed to somethig like this:

echo -n "Restarting $DESC: $NAME" - d_stop + kill `cat $PIDFILE` || echo -en "\n not running"

;; *) echo "Usage: $SCRIPTNAME {start|stop|restart|reload}" >&2 exit 3 ;; esac

exit 0