-
Notifications
You must be signed in to change notification settings - Fork 1
/
openstack-dns.init
executable file
·81 lines (69 loc) · 1.3 KB
/
openstack-dns.init
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
70
71
72
73
74
75
76
77
78
79
80
81
#!/bin/sh
#
# keystone OpenStack dns management
#
# chkconfig: - 20 80
# description: openstack dns management
### END INIT INFO
. /etc/rc.d/init.d/functions
prog=openstack-dns
exec="/opt/openstackdns/openstack-dns"
config="/opt/openstack/dns.conf"
pidfile="/var/run/$prog/$prog.pid"
[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
lockfile=/var/lock/subsys/$prog
start() {
echo -n $"Starting $prog: "
daemon --user nova $exec -c $config
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/openstack-dns
}
stop() {
echo -n $"Stopping $prog: "
P=`/bin/ps awux|/bin/grep $exec|/bin/grep -v grep|/bin/awk '{print $2 }'`
if ! test -z "$P"; then
kill $P
fi
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/openstack-dns
}
restart() {
stop
start
}
reload() {
restart
}
force_reload() {
restart
}
checkstatus() {
R=`/bin/ps awux|/bin/grep $exec|/bin/grep -v grep`
if test -z "$R"; then
echo "$prog stopped"
RETVAL=3
else
echo "$prog running ($R)"
RETVAL=0
fi
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
status)
checkstatus
;;
*)
echo $"Usage: $0 {start|stop|status|restart}"
exit 2
esac
exit $RETVAL