Permalink
Browse files

Fix nginx init script.

  • Loading branch information...
1 parent a55e7f4 commit e22d35ff06fc5185ca8531203935a53bdc6cda02 @huacnlee committed Sep 26, 2011
Showing with 13 additions and 9 deletions.
  1. +1 −1 README.textile
  2. +0 −1 install
  3. +12 −7 nginx
View
@@ -8,5 +8,5 @@ h2. Include services and Application/Config files location
* Redis (/usr/local/bin/redis, /usr/local/etc/redis.conf)
* MongoDB (/usr/local/bin/mongod, /usr/local/etc/mongodb.conf)
-* Nginx (/usr/local/bin/nginx, nginx.conf in /usr/local/nginx/conf)
+* Nginx (/usr/local/nginx/sbin/nginx, nginx.conf in /usr/local/nginx/conf)
* PHP-CGI (sudo apt-get install php5-cgi)
View
@@ -8,7 +8,6 @@ sudo mkdir /var/log/mongodb
sudo update-rc.d mongodb defaults
sudo cp nginx /etc/init.d/
-sudo mkdir /var/run/nginx
sudo update-rc.d nginx defaults
sudo cp php-cgi /etc/init.d/
View
19 nginx
@@ -11,41 +11,45 @@
### END INIT INFO
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
-DAEMON=/usr/local/bin/nginx
-PIDFILE=/var/run/nginx/nginx.pid
+DAEMON=/usr/local/nginx/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 $PIDFILE \
+ 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 $PIDFILE \
+ 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 \
- $PIDFILE --exec $DAEMON
+ /usr/local/nginx/logs/$NAME.pid --exec $DAEMON
sleep 1
start-stop-daemon --start --quiet --pidfile \
- $PIDFILE --exec $DAEMON -- $DAEMON_OPTS
+ /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 $PIDFILE \
+ start-stop-daemon --stop --signal HUP --quiet --pidfile /usr/local/nginx/logs/$NAME.pid \
--exec $DAEMON
echo "$NAME."
;;
@@ -57,3 +61,4 @@ case "$1" in
esac
exit 0
+

0 comments on commit e22d35f

Please sign in to comment.