updated on Thu Jan 12 08:01:00 UTC 2012
[aur-mirror.git] / nginx-passenger / nginx
blob2d5a02a47d439cf30220b67a4045b27160bd7dc1
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 -q -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 $0 careless_start
26 careless_start)
27 stat_busy "Starting Nginx"
28 if [ -s /var/run/nginx.pid ]; then
29 stat_fail
30 # probably ;)
31 stat_busy "Nginx is already running"
32 stat_die
34 /usr/sbin/nginx -c "$NGINX_CONFIG" &>/dev/null
35 if [ $? -ne 0 ]; then
36 stat_fail
37 else
38 add_daemon nginx
39 stat_done
42 stop)
43 stat_busy "Stopping Nginx"
44 kill -QUIT `cat /var/run/nginx.pid` &>/dev/null
45 if [ $? -ne 0 ]; then
46 stat_fail
47 else
48 rm_daemon nginx
49 stat_done
52 restart)
53 check_config
54 $0 stop
55 sleep 1
56 $0 careless_start
58 reload)
59 check_config
60 if [ -s /var/run/nginx.pid ]; then
61 status "Reloading Nginx Configuration" kill -HUP `cat /var/run/nginx.pid`
64 check)
65 check_config
68 echo "usage: $0 {start|stop|restart|reload|check|careless_start}"
69 esac