remove $proj-dist.conf for centos
[openstack-build/neutron-build.git] / rpm / SOURCES / neutron-server.init
1 #!/bin/bash
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 configs=(
15     "/etc/$prog/$prog.conf" \
16     "/etc/$prog/plugin.ini" \
17 )
18 pidfile="/var/run/$prog/$prog.pid"
19 logfile="/var/log/$prog/server.log"
20
21 [ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
22
23 lockfile=/var/lock/subsys/$prog-server
24
25 start() {
26     [ -x $exec ] || exit 5
27     for config in ${configs[@]}; do
28         [ -f $config ] || exit 6
29     done
30     echo -n $"Starting $prog: "
31     daemon --user neutron --pidfile $pidfile "$exec ${configs[@]/#/--config-file } --log-file $logfile &>/dev/null & echo \$! > $pidfile"
32     retval=$?
33     echo
34     [ $retval -eq 0 ] && touch $lockfile
35     return $retval
36 }
37
38 stop() {
39     echo -n $"Stopping $prog: "
40     killproc -p $pidfile $prog
41     retval=$?
42     echo
43     [ $retval -eq 0 ] && rm -f $lockfile
44     return $retval
45 }
46
47 restart() {
48     stop
49     start
50 }
51
52 reload() {
53     restart
54 }
55
56 force_reload() {
57     restart
58 }
59
60 rh_status() {
61     status -p $pidfile $prog
62 }
63
64 rh_status_q() {
65     rh_status >/dev/null 2>&1
66 }
67
68
69 case "$1" in
70     start)
71         rh_status_q && exit 0
72         $1
73         ;;
74     stop)
75         rh_status_q || exit 0
76         $1
77         ;;
78     restart)
79         $1
80         ;;
81     reload)
82         rh_status_q || exit 7
83         $1
84         ;;
85     force-reload)
86         force_reload
87         ;;
88     status)
89         rh_status
90         ;;
91     condrestart|try-restart)
92         rh_status_q || exit 0
93         restart
94         ;;
95     *)
96         echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
97         exit 2
98 esac
99 exit $?