# Nginx init script for redhat (rhel5)

**URL:** <https://www.ruby-forum.com/t/nginx-init-script-for-redhat-rhel5/163070>\
**Category:** NGINX\
**Created:** [March 17, 2009, 4:01am UTC](https://www.ruby-forum.com/t/nginx-init-script-for-redhat-rhel5/163070 "2009-03-17T04:01:52Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![mike](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/58f4c7/32.png) [@mike](https://www.ruby-forum.com/u/mike)\
**Post date:** [March 17, 2009, 4:01am UTC](https://www.ruby-forum.com/t/nginx-init-script-for-redhat-rhel5/163070/1 "2009-03-17T04:01:52Z")

</div>

for the most part, it works fine.

however, sometimes the pid file disappears (?)  
also, “restart” does not work if the daemon is not running already. it  
should handle that gracefully.

anyone have a better one? i also have the same issue with “restart” on  
my ubuntu version as well…

#!/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 N. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

# Modified: Geoffrey Grosenbach [http://topfunky.com](http://topfunky.com)

# Modified: David K. [http://davidhq.com](http://davidhq.com)

# Modified: Vishnu G. [http://vish.in](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 “.”  
;;  
\*)  
echo “Usage: $SCRIPTNAME {start|stop|restart|reload}” \>&2  
exit 3  
;;  
esac

exit 0

---

<div class="post-metadata">

**Author:** ![mike](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/58f4c7/32.png) [@mike](https://www.ruby-forum.com/u/mike)\
**Post date:** [March 17, 2009, 4:21am UTC](https://www.ruby-forum.com/t/nginx-init-script-for-redhat-rhel5/163070/2 "2009-03-17T04:21:10Z")

</div>

Better probably, not. This is what I use. At least it works.

#! /bin/sh

# 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.

# 

#chkconfig: 2345 55 25

# 

# Author: Ryan N. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

# Modified: Geoffrey Grosenbach [http://topfunky.com](http://topfunky.com)

set -e

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

# Gracefully exit if the package has been removed.

test -x $DAEMON || exit 0

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

d\_stop() {  
kill -15 `cat $PIDFILE` || echo -n " not running"  
}

d\_reload() {  
kill -15 `cat $PIDFILE` || echo -n " can’t reload"  
}

case “$1” in  
start)  
echo -n “Starting $DESC: $NAME”  
d\_start  
echo “.”  
/etc/init.d/httpd start  
;;  
stop)  
echo -n “Stopping $DESC: $NAME”  
d\_stop  
echo “.”  
/etc/init.d/httpd stop  
;;  
reload)  
echo -n “Reloading $DESC configuration…”  
d\_reload  
echo “reloaded.”  
/etc/init.d/httpd restart  
;;  
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 “.”  
/etc/init.d/httpd restart  
;;  
\*)  
echo “Usage: $SCRIPTNAME {start|stop|restart|force-reload}” \>&2  
exit 3  
;;  
esac

exit 0

---

<div class="post-metadata">

**Author:** ![mike](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/58f4c7/32.png) [@mike](https://www.ruby-forum.com/u/mike)\
**Post date:** [March 17, 2009, 4:24am UTC](https://www.ruby-forum.com/t/nginx-init-script-for-redhat-rhel5/163070/3 "2009-03-17T04:24:41Z")

</div>

I use this one that relies on the start stop daemon –  
[http://developer.axis.com/download/distribution/apps-sys-utils-start-stop-daemon-IR1\_9\_18-2.tar.gz](http://developer.axis.com/download/distribution/apps-sys-utils-start-stop-daemon-IR1_9_18-2.tar.gz).

After its unpacked:

$ cd apps/sys-utils/start-stop-daemon-IR1\_9\_18-2/  
$gcc start-stop-daemon.c -o start-stop-daemon

Then copy it to /usr/local/sbin or wherever suits your fancy.

I have no issues with the pid file but it also ignores a restart request  
if not running.

#! /bin/sh

### BEGIN INIT INFO

# Provides: nginx

# Required-Start: $all

# Required-Stop: $all

# Default-Start: 2 3 4 5

# Default-Stop: 0 1 6

# Short-Description: starts the nginx web server

# Description: starts nginx using start-stop-daemon

### END INIT INFO

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin  
DAEMON=/usr/local/sbin/nginx  
NAME=nginx  
DESC=nginx

test -x $DAEMON || exit 0

# Include nginx defaults if available

if [-f /etc/default/nginx] ; then  
. /etc/default/nginx  
fi

set -e

case “$1” in  
start)  
echo -n "Starting $DESC: "  
start-stop-daemon --start --quiet --pidfile  
/usr/local/nginx/logs/$NAME.pid   
–exec $DAEMON – $DAEMON\_OPTS  
echo “$NAME.”  
;;  
stop)  
echo -n "Stopping $DESC: "  
start-stop-daemon --stop --quiet --pidfile  
/usr/local/nginx/logs/$NAME.pid   
–exec $DAEMON  
echo “$NAME.”  
;;  
restart|force-reload)  
echo -n "Restarting $DESC: "  
start-stop-daemon --stop --quiet --pidfile   
/usr/local/nginx/logs/$NAME.pid --exec $DAEMON  
sleep 1  
start-stop-daemon --start --quiet --pidfile   
/usr/local/nginx/logs/$NAME.pid --exec $DAEMON –  
$DAEMON\_OPTS  
echo “$NAME.”  
;;  
reload)  
echo -n "Reloading $DESC configuration: "  
start-stop-daemon --stop --signal HUP --quiet --pidfile  
/usr/local/nginx/logs/$NAME.pid   
–exec $DAEMON  
echo “$NAME.”  
;;  
\*)  
N=/etc/init.d/$NAME  
echo “Usage: $N {start|stop|restart|force-reload}” \>&2  
exit 1  
;;  
esac

exit 0

---

<div class="post-metadata">

**Author:** ![mike](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/58f4c7/32.png) [@mike](https://www.ruby-forum.com/u/mike)\
**Post date:** [March 17, 2009, 4:29am UTC](https://www.ruby-forum.com/t/nginx-init-script-for-redhat-rhel5/163070/4 "2009-03-17T04:29:22Z")

</div>

On Mon, Mar 16, 2009 at 8:15 PM, Jim O. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> I use this one that relies on the start stop daemon –  
> [http://developer.axis.com/download/distribution/apps-sys-utils-start-stop-daemon-IR1\_9\_18-2.tar.gz](http://developer.axis.com/download/distribution/apps-sys-utils-start-stop-daemon-IR1_9_18-2.tar.gz).

yeah … i use one relatively similar for ubuntu. but i’d rather use  
out-of-the-box rhel5/epel/rpmfusion supportable stuff.

when it comes down to it if i have to figure out bash script hacking  
for it, so be it. just thought i’d ask.

the odd thing is when the pid file can’t be found. that one will  
require a killall -9 nginx i suppose. and the restart should be taken  
care of as well then too.

---

<div class="post-metadata">

**Author:** ![mike](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/58f4c7/32.png) [@mike](https://www.ruby-forum.com/u/mike)\
**Post date:** [March 17, 2009, 4:26am UTC](https://www.ruby-forum.com/t/nginx-init-script-for-redhat-rhel5/163070/5 "2009-03-17T04:26:26Z")

</div>

looks like yours also starts /etc/init.d/httpd (most likely apache) as  
well?

On Mon, Mar 16, 2009 at 8:11 PM, Chris Z.

---

<div class="post-metadata">

**Author:** ![mike](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/58f4c7/32.png) [@mike](https://www.ruby-forum.com/u/mike)\
**Post date:** [March 17, 2009, 4:46am UTC](https://www.ruby-forum.com/t/nginx-init-script-for-redhat-rhel5/163070/6 "2009-03-17T04:46:19Z")

</div>

[http://wiki.nginx.org/RedHatInitScript](http://wiki.nginx.org/RedHatInitScript)

---

<div class="post-metadata">

**Author:** ![mike](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/58f4c7/32.png) [@mike](https://www.ruby-forum.com/u/mike)\
**Post date:** [March 17, 2009, 4:34am UTC](https://www.ruby-forum.com/t/nginx-init-script-for-redhat-rhel5/163070/7 "2009-03-17T04:34:03Z")

</div>

Err you could probably remove the httpd lines. That’s for cpanel. Sorry.

---

<div class="post-metadata">

**Author:** ![mike](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/58f4c7/32.png) [@mike](https://www.ruby-forum.com/u/mike)\
**Post date:** [March 17, 2009, 4:51am UTC](https://www.ruby-forum.com/t/nginx-init-script-for-redhat-rhel5/163070/8 "2009-03-17T04:51:00Z")

</div>

Oops. Ignore that. Here’s what I use:

> **[Red Hat NGINX Init Script | NGINX](https://www.nginx.com/resources/wiki/start/topics/examples/redhatnginxinit/)**
>
> An example NGINX init script that works on Red Hat systems.

Regards,  
Cliff

---

<div class="post-metadata">

**Author:** ![mike](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/58f4c7/32.png) [@mike](https://www.ruby-forum.com/u/mike)\
**Post date:** [March 17, 2009, 5:03am UTC](https://www.ruby-forum.com/t/nginx-init-script-for-redhat-rhel5/163070/9 "2009-03-17T05:03:51Z")

</div>

On Mon, Mar 16, 2009 at 8:51 PM, mike [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> On Mon, Mar 16, 2009 at 8:44 PM, Cliff W. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > Oops. Â Ignore that. Â Here’s what I use:
> > 
> > [GitHub - nginxinc/nginx-wiki: ARCHIVED -- Source for the now archived NGINX Wiki section of https://www.nginx.com · GitHub](http://wiki.nginx.org/RedHatNginxInitScript)
> 
> Got that in plaintext? It wants to copy all the whitespace in my browser too 😛

n/m firefox to the rescue.

---

<div class="post-metadata">

**Author:** ![mike](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/58f4c7/32.png) [@mike](https://www.ruby-forum.com/u/mike)\
**Post date:** [March 17, 2009, 4:59am UTC](https://www.ruby-forum.com/t/nginx-init-script-for-redhat-rhel5/163070/10 "2009-03-17T04:59:46Z")

</div>

On Mon, Mar 16, 2009 at 8:44 PM, Cliff W. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Oops. Â Ignore that. Â Here’s what I use:
> 
> [GitHub - nginxinc/nginx-wiki: ARCHIVED -- Source for the now archived NGINX Wiki section of https://www.nginx.com · GitHub](http://wiki.nginx.org/RedHatNginxInitScript)

Got that in plaintext? It wants to copy all the whitespace in my browser  
too 😛

For sharing sake this seems to be pretty foolproof too. Should kill  
off rogue instances that don’t match the pidfile etc.

even “reload” will restart it if it isn’t actually running.

#!/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 N. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

# Modified: Geoffrey Grosenbach [http://topfunky.com](http://topfunky.com)

# Modified: David K. [http://davidhq.com](http://davidhq.com)

# Modified: Vishnu G. [http://vish.in](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 “ERROR: Could not start.\n”  
}

d\_stop() {  
if [-f $PIDFILE]; then  
kill -QUIT `cat $PIDFILE` || echo -en “INFO: not running.\n”  
fi

# force kill

pgrep -f “nginx:” | xargs --no-run-if-empty kill -9 2\>/dev/null  
rm -f $PIDFILE  
}

d\_reload() {  
if [-f $PIDFILE]; then  
kill -HUP `cat $PIDFILE` || echo -en “ERROR: can’t reload.\n”  
else  
echo -en “NOTICE: can’t reload, force (re)starting\n”  
$SCRIPTNAME restart  
fi  
}

case “$1” in  
start)  
echo -en “Starting $DESC: $NAME\n”  
d\_start  
;;  
stop)  
echo -en “Stopping $DESC: $NAME\n”  
d\_stop  
;;  
reload)  
echo -en “Reloading $DESC configuration…\n”  
d\_reload  
;;  
restart)  
echo -en “Restarting $DESC: $NAME\n”  
d\_stop  
sleep 1  
d\_start  
;;  
\*)  
echo “Usage: $SCRIPTNAME {start|stop|restart|reload}” \>&2  
exit 3  
;;  
esac

exit 0

---

<div class="post-metadata">

**Author:** ![mike](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/58f4c7/32.png) [@mike](https://www.ruby-forum.com/u/mike)\
**Post date:** [March 17, 2009, 5:27am UTC](https://www.ruby-forum.com/t/nginx-init-script-for-redhat-rhel5/163070/11 "2009-03-17T05:27:17Z")

</div>

On Mon, 2009-03-16 at 20:52 -0700, mike wrote:

> On Mon, Mar 16, 2009 at 8:51 PM, mike [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > On Mon, Mar 16, 2009 at 8:44 PM, Cliff W. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> > 
> > > Oops. Ignore that. Here’s what I use:
> > > 
> > > [GitHub - nginxinc/nginx-wiki: ARCHIVED -- Source for the now archived NGINX Wiki section of https://www.nginx.com · GitHub](http://wiki.nginx.org/RedHatNginxInitScript)
> > 
> > Got that in plaintext? It wants to copy all the whitespace in my browser too 😛
> 
> n/m firefox to the rescue.

If you click the link right above the script, it should offer to  
download it for you.

Cliff

---

<div class="post-metadata">

**Author:** ![mike](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/58f4c7/32.png) [@mike](https://www.ruby-forum.com/u/mike)\
**Post date:** [March 17, 2009, 5:36am UTC](https://www.ruby-forum.com/t/nginx-init-script-for-redhat-rhel5/163070/12 "2009-03-17T05:36:39Z")

</div>

Now I just need one for Ubuntu with the same amount of intelligence. 😛

---

<div class="post-metadata">

**Author:** ![mike](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/58f4c7/32.png) [@mike](https://www.ruby-forum.com/u/mike)\
**Post date:** [March 17, 2009, 5:34am UTC](https://www.ruby-forum.com/t/nginx-init-script-for-redhat-rhel5/163070/13 "2009-03-17T05:34:18Z")

</div>

i got it.

thanks - this seems to work even better than mine.

/me adds it to his installer

---

<div class="post-metadata">

**Author:** ![mike](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/58f4c7/32.png) [@mike](https://www.ruby-forum.com/u/mike)\
**Post date:** [March 17, 2009, 8:40am UTC](https://www.ruby-forum.com/t/nginx-init-script-for-redhat-rhel5/163070/14 "2009-03-17T08:40:19Z")

</div>

Hello,

I had the same problem. After adding ‘sleep 1’ it works.

Jeroen

---

<div class="post-metadata">

**Author:** ![mike](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/58f4c7/32.png) [@mike](https://www.ruby-forum.com/u/mike)\
**Post date:** [March 17, 2009, 9:58am UTC](https://www.ruby-forum.com/t/nginx-init-script-for-redhat-rhel5/163070/15 "2009-03-17T09:58:49Z")

</div>

i have updated the wiki.

On Tue, Mar 17, 2009 at 12:29 AM, Jeroen Steggink - CMS

---

<div class="post-metadata">

**Author:** ![mike](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/58f4c7/32.png) [@mike](https://www.ruby-forum.com/u/mike)\
**Post date:** [March 17, 2009, 8:10am UTC](https://www.ruby-forum.com/t/nginx-init-script-for-redhat-rhel5/163070/16 "2009-03-17T08:10:51Z")

</div>

I changed this minorly

restart() {  
configtest || return $?  
stop  
sleep 1  
start  
}

to include that sleep 1

it seems sometimes “stop” doesn’t clean things up fast enough perhaps.  
since then i have had no issues

[root@mia32217www002 build]# service nginx restart  
2009/03/16 22:48:01 [info] 2934#0: the configuration file  
/etc/nginx/nginx.conf syntax is ok  
2009/03/16 22:48:01 [info] 2934#0: the configuration file  
/etc/nginx/nginx.conf was tested successfully Stopping nginx: [OK]  
Starting nginx: [OK]  
[root@mia32217www002 build]# service nginx restart  
2009/03/16 22:48:03 [info] 2957#0: the configuration file  
/etc/nginx/nginx.conf syntax is ok  
2009/03/16 22:48:03 [info] 2957#0: the configuration file  
/etc/nginx/nginx.conf was tested successfully Stopping nginx: [OK]  
Starting nginx: [OK]  
[root@mia32217www002 build]# service nginx restart  
2009/03/16 22:48:03 [info] 2980#0: the configuration file  
/etc/nginx/nginx.conf syntax is ok  
2009/03/16 22:48:03 [info] 2980#0: the configuration file  
/etc/nginx/nginx.conf was tested successfully Stopping nginx: [OK]  
Starting nginx:  
[root@mia32217www002 build]# service nginx restart  
2009/03/16 22:49:04 [info] 3052#0: the configuration file  
/etc/nginx/nginx.conf syntax is ok  
2009/03/16 22:49:04 [info] 3052#0: the configuration file  
/etc/nginx/nginx.conf was tested successfully Stopping nginx: [FAILED]  
Starting nginx: [OK]

^^ that fourth time it failed…

sleep 1 so far seems to be foolproof. my provider probably hates me  
ive been restarting it over and over.

---

<div class="post-metadata">

**Author:** ![mike](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/58f4c7/32.png) [@mike](https://www.ruby-forum.com/u/mike)\
**Post date:** [March 17, 2009, 10:51am UTC](https://www.ruby-forum.com/t/nginx-init-script-for-redhat-rhel5/163070/17 "2009-03-17T10:51:04Z")

</div>

mike a Ã©crit :

> Now I just need one for Ubuntu with the same amount of intelligence. 😛
> 
> On Mon, Mar 16, 2009 at 9:24 PM, mike [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > i got it.
> > 
> > thanks - this seems to work even better than mine.
> > 
> > /me adds it to his installer

You can use debian/ubuntu one :  
[http://svn.debian.org/wsvn/collab-maint/deb-maint/nginx/trunk/debian/init.d?op=file&rev=0&sc=0](http://svn.debian.org/wsvn/collab-maint/deb-maint/nginx/trunk/debian/init.d?op=file&rev=0&sc=0)

It works fine for me with a “custom” nginx install, you just have to  
edit the  
path to the daemon and if necessary add a var for the PID file.

---

<div class="post-metadata">

**Author:** ![mike](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/58f4c7/32.png) [@mike](https://www.ruby-forum.com/u/mike)\
**Post date:** [March 17, 2009, 6:32pm UTC](https://www.ruby-forum.com/t/nginx-init-script-for-redhat-rhel5/163070/18 "2009-03-17T18:32:34Z")

</div>

On Tue, Mar 17, 2009 at 2:43 AM, Jean-Philippe M.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> You can use debian/ubuntu one :  
> [http://svn.debian.org/wsvn/collab-maint/deb-maint/nginx/trunk/debian/init.d?op=file&rev=0&sc=0](http://svn.debian.org/wsvn/collab-maint/deb-maint/nginx/trunk/debian/init.d?op=file&rev=0&sc=0)
> 
> It works fine for me with a “custom” nginx install, you just have to edit the  
> path to the daemon and if necessary add a var for the PID file.

I might give it a shot. I think I’d rather port Cliff’s. It does a  
config test on start/reload/restart, which is neat.

I’m actually using one almost identical to yours except yours has “||  
true” at the end of each line:

–exec $DAEMON – $DAEMON\_OPTS || true

So I don’t think it will be much different.

Or, if someone else on the list wants to take Cliff’s and port it to  
Ubuntu using start-stop-daemon (ideally) I’ll Paypal you some cash.

(Note: payment will be done after I test it thoroughly for all  
functionality in place :))
