Merge "Update RPM-specs to 2013.2 version" into openstack-ci/build/havana
[openstack-build/neutron-build.git] / rpm / SOURCES / neutron-server.init
1 #!/bin/sh
2 #
3 # neutron  OpenStack Software Defined Networking Service
4 #
5 # chkconfig:   - 98 02
6 # description: neutron provides an API to  \
7 #               * request and configure virtual networks
8 ### END INIT INFO
9
10 . /etc/rc.d/init.d/functions
11
12 prog=neutron
13 exec="/usr/bin/$prog-server"
14 config="/etc/$prog/$prog.conf"
15 pidfile="/var/run/$prog/$prog.pid"
16 logfile="/var/log/$prog/server.log"
17
18 [ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
19
20 lockfile=/var/lock/subsys/$prog-server
21
22 start() {
23     [ -x $exec ] || exit 5
24     [ -f $config ] || exit 6
25     echo -n $"Starting $prog: "
26     daemon --user neutron --pidfile $pidfile "$exec --config-file $config --config-file /etc/$prog/plugin.ini --log-file $logfile &>/dev/null & echo \$! > $pidfile"
27     retval=$?
28     echo
29     [ $retval -eq 0 ] && touch $lockfile
30     return $retval
31 }
32
33 stop() {
34     echo -n $"Stopping $prog: "
35     killproc -p $pidfile $prog
36     retval=$?
37     echo
38     [ $retval -eq 0 ] && rm -f $lockfile
39     return $retval
40 }
41
42 restart() {
43     stop
44     start
45 }
46
47 reload() {
48     restart
49 }
50
51 force_reload() {
52     restart
53 }
54
55 rh_status() {
56     status -p $pidfile $prog
57 }
58
59 rh_status_q() {
60     rh_status >/dev/null 2>&1
61 }
62
63
64 case "$1" in
65     start)
66         rh_status_q && exit 0
67         $1
68         ;;
69     stop)
70         rh_status_q || exit 0
71         $1
72         ;;
73     restart)
74         $1
75         ;;
76     reload)
77         rh_status_q || exit 7
78         $1
79         ;;
80     force-reload)
81         force_reload
82         ;;
83     status)
84         rh_status
85         ;;
86     condrestart|try-restart)
87         rh_status_q || exit 0
88         restart
89         ;;
90     *)
91         echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
92         exit 2
93 esac
94 exit $?