updated on Sun Jan 15 00:02:00 UTC 2012
[aur-mirror.git] / passenger-enterprise-nginx / nginx
blob374e141419a734af8450b7af46f10d62308792e9
1 #!/bin/bash
3 # general config
5 NGINX_CONFIG="/etc/nginx/conf/nginx.conf"
7 . /etc/conf.d/nginx
8 . /etc/rc.conf
9 . /etc/rc.d/functions
11 function check_config {
12 stat_busy "Checking configuration"
13 /usr/sbin/nginx -t -c "$NGINX_CONFIG"
14 if [ $? -ne 0 ]; then
15 stat_die
16 else
17 stat_done
21 case "$1" in
22 start)
23 check_config
24 stat_busy "Starting Nginx"
25 if [ -s /var/run/nginx.pid ]; then
26 stat_fail
27 # probably ;)
28 stat_busy "Nginx is already running"
29 stat_die
31 /usr/sbin/nginx -c "$NGINX_CONFIG" &>/dev/null
32 if [ $? -ne 0 ]; then
33 stat_fail
34 else
35 add_daemon nginx
36 stat_done
39 stop)
40 stat_busy "Stopping Nginx"
41 kill -QUIT `cat /var/run/nginx.pid` &>/dev/null
42 if [ $? -ne 0 ]; then
43 stat_fail
44 else
45 rm_daemon nginx
46 stat_done
49 restart)
50 $0 stop
51 sleep 1
52 $0 start
54 reload)
55 check_config
56 if [ -s /var/run/nginx.pid ]; then
57 status "Reloading Nginx Configuration" kill -HUP `cat /var/run/nginx.pid`
60 check)
61 check_config
64 echo "usage: $0 {start|stop|restart|reload|check}"
65 esac