gabriel / capitate

Capistrano recipes, plugins and templates.

This URL has Read+Write access

capitate / lib / templates / nginx / nginx.initd.centos.erb
100644 69 lines (61 sloc) 1.138 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#! /bin/sh
# nginx Startup script for nginx
#
# chkconfig: - 86 14
# description: nginx web server
#
# Author: Ryan Norbauer <ryan.norbauer@gmail.com>
# Modified: Geoffrey Grosenbach http://topfunky.com
# Modified: Gabriel Handford http://ducktyper.com
 
# Source function library
. /etc/rc.d/init.d/functions
 
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DESC="nginx daemon"
NAME=nginx
DAEMON=<%= nginx_bin_path %>
CONFIGFILE=<%= nginx_conf_path %>
PIDFILE=<%= nginx_pid_path %>
 
# Gracefully exit if the package has been removed.
test -x $DAEMON || exit 0
 
start() {
  echo -n $"Starting $DESC: "
  daemon $DAEMON -c $CONFIGFILE
  RETVAL=$?
  echo
return $RETVAL;
}
 
stop() {
  echo -n $"Stopping $DESC: "
  killproc -p $PIDFILE nginx -QUIT
  RETVAL=$?
  echo
return $RETVAL;
}
 
reload() {
  echo -n $"Reloading $DESC: "
  killproc -p $PIDFILE nginx -HUP
  RETVAL=$?
  echo
return $RETVAL;
}
 
case "$1" in
  start)
   start
;;
  stop)
   stop
;;
  reload)
   reload
  ;;
  restart)
   stop
   sleep 1
   start
;;
  *)
echo "Usage: $0 {start|stop|restart|reload}" >&2
exit 3
;;
esac
 
exit $RETVAL;