-
Notifications
You must be signed in to change notification settings - Fork 10
/
policy-rc.d
executable file
·82 lines (72 loc) · 1.25 KB
/
policy-rc.d
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
82
#!/bin/bash
DISABLE_ACTIONS=(start restart)
DISABLED_SERVICES=(rabbitmq-server)
longoptions='quiet,force,try-anyway,disclose-deny,query,no-fallback,help'
getopt=$(getopt -o '' --longoptions $longoptions -- "$@")
if [ $? != 0 ]; then
echo "ERROR!"
exit 1;
fi
eval set -- "$getopt"
while true; do
case "$1" in
--quiet)
QUIET=1
shift
;;
--force)
FORCE=1
shift
;;
--try-anyway)
TRY_ANYWAY=1
shift
;;
--disclose-deny)
DISCLOSE_DENY=1
shift
;;
--query)
QUERY=1
shift
;;
--no-fallback)
NO_FALLBACK=1
shift
;;
--)
shift
break
;;
*)
echo "There should probably be some help text here!"
exit 1
;;
esac
done
SRV_NAME=$1
shift
SRV_ACTION=$1
SRV_ARGS=$*
SRV_DISABLED=0
ACT_DISABLED=0
if [ ! -f "/etc/init.d/${SRV_NAME}" ]; then
exit 100
fi
for i in "${DISABLED_SERVICES}"
do
if [ $i = $SRV_NAME ]; then
SRV_DISABLED=1
fi
done
for i in "${DISABLE_ACTIONS}"
do
if [ $i = $SRV_ACTION ]; then
ACT_DISABLED=1
fi
done
if [ $SRV_DISABLED -eq 1 -a $ACT_DISABLED -eq 1 ]; then
exit 101
else
exit 104
fi