Revision 5d8acbdd daemons/daemon-util.in
b/daemons/daemon-util.in | ||
---|---|---|
22 | 22 |
|
23 | 23 |
defaults_file=@SYSCONFDIR@/default/ganeti |
24 | 24 |
|
25 |
# This is a list of all daemons and the order in which they're started. The |
|
26 |
# order is important as there are dependencies between them. On shutdown, |
|
27 |
# they're stopped in reverse order. |
|
28 |
DAEMONS=( |
|
29 |
ganeti-noded |
|
30 |
ganeti-masterd |
|
31 |
ganeti-rapi |
|
32 |
ganeti-confd |
|
33 |
) |
|
34 |
|
|
25 | 35 |
NODED_ARGS= |
26 | 36 |
MASTERD_ARGS= |
27 | 37 |
CONFD_ARGS= |
... | ... | |
74 | 84 |
return 0 |
75 | 85 |
} |
76 | 86 |
|
87 |
# Prints a list of all daemons in the order in which they should be started |
|
88 |
list_start_daemons() { |
|
89 |
local name |
|
90 |
|
|
91 |
for name in "${DAEMONS[@]}"; do |
|
92 |
echo "$name" |
|
93 |
done |
|
94 |
} |
|
95 |
|
|
96 |
# Prints a list of all daemons in the order in which they should be stopped |
|
97 |
list_stop_daemons() { |
|
98 |
list_start_daemons | tac |
|
99 |
} |
|
100 |
|
|
101 |
# Checks whether a daemon name is known |
|
102 |
is_daemon_name() { |
|
103 |
if [[ "$#" -lt 1 ]]; then |
|
104 |
echo 'Missing daemon name.' >&2 |
|
105 |
return 1 |
|
106 |
fi |
|
107 |
|
|
108 |
local name="$1"; shift |
|
109 |
|
|
110 |
for i in "${DAEMONS[@]}"; do |
|
111 |
if [[ "$i" == "$name" ]]; then |
|
112 |
return 0 |
|
113 |
fi |
|
114 |
done |
|
115 |
|
|
116 |
echo "Unknown daemon name '$name'" >&2 |
|
117 |
return 1 |
|
118 |
} |
|
119 |
|
|
77 | 120 |
# Checks whether daemon is running |
78 | 121 |
check() { |
79 | 122 |
if [[ "$#" -lt 1 ]]; then |
Also available in: Unified diff