Lines 37-56
show_instances()
Link Here
|
37 |
case $show in |
37 |
case $show in |
38 |
"all") |
38 |
"all") |
39 |
if instance_filter_email $instance $show_email && \ |
39 |
if instance_filter_email $instance $show_email && \ |
40 |
instance_filter_sip $instance $show_sip; then |
40 |
instance_filter_plack $instance $show_plack && \ |
|
|
41 |
instance_filter_sip $instance $show_sip; then |
41 |
echo $instance |
42 |
echo $instance |
42 |
fi ;; |
43 |
fi ;; |
43 |
"enabled") |
44 |
"enabled") |
44 |
if is_enabled $instance; then |
45 |
if is_enabled $instance; then |
45 |
if instance_filter_email $instance $show_email && \ |
46 |
if instance_filter_email $instance $show_email && \ |
46 |
instance_filter_sip $instance $show_sip; then |
47 |
instance_filter_plack $instance $show_plack && \ |
|
|
48 |
instance_filter_sip $instance $show_sip; then |
47 |
echo $instance |
49 |
echo $instance |
48 |
fi |
50 |
fi |
49 |
fi ;; |
51 |
fi ;; |
50 |
"disabled") |
52 |
"disabled") |
51 |
if ! is_enabled $instance; then |
53 |
if ! is_enabled $instance; then |
52 |
if instance_filter_email $instance $show_email && \ |
54 |
if instance_filter_email $instance $show_email && \ |
53 |
instance_filter_sip $instance $show_sip; then |
55 |
instance_filter_plack $instance $show_plack && \ |
|
|
56 |
instance_filter_sip $instance $show_sip; then |
54 |
echo $instance |
57 |
echo $instance |
55 |
fi |
58 |
fi |
56 |
fi ;; |
59 |
fi ;; |
Lines 81-86
instance_filter_sip()
Link Here
|
81 |
return 1 |
84 |
return 1 |
82 |
} |
85 |
} |
83 |
|
86 |
|
|
|
87 |
instance_filter_plack() |
88 |
{ |
89 |
local instancename=$1 |
90 |
local show_plack=$2; |
91 |
|
92 |
case $show_plack in |
93 |
"all") |
94 |
return 0 ;; |
95 |
"enabled") |
96 |
if is_plack_enabled $instancename; then |
97 |
return 0 |
98 |
fi ;; |
99 |
"disabled") |
100 |
if ! is_plack_enabled $instancename; then |
101 |
return 0 |
102 |
fi ;; |
103 |
esac |
104 |
|
105 |
# Didn't match any criteria |
106 |
return 1 |
107 |
} |
108 |
|
84 |
instance_filter_email() |
109 |
instance_filter_email() |
85 |
{ |
110 |
{ |
86 |
local instancename=$1 |
111 |
local instancename=$1 |
Lines 125-130
set_show_email()
Link Here
|
125 |
fi |
150 |
fi |
126 |
} |
151 |
} |
127 |
|
152 |
|
|
|
153 |
set_show_plack() |
154 |
{ |
155 |
local plack_param=$1 |
156 |
|
157 |
if [ "$show_plack" = "all" ]; then |
158 |
show_plack=$plack_param |
159 |
else |
160 |
die "Error: --plack and --noplack are mutually exclusive." |
161 |
fi |
162 |
} |
163 |
|
128 |
set_show_sip() |
164 |
set_show_sip() |
129 |
{ |
165 |
{ |
130 |
local sip_param=$1 |
166 |
local sip_param=$1 |
Lines 146-157
email turned on.
Link Here
|
146 |
|
182 |
|
147 |
Usage: $scriptname [--enabled|--disabled] [--email|--noemail] [--sip|--nosip] [-h] |
183 |
Usage: $scriptname [--enabled|--disabled] [--email|--noemail] [--sip|--nosip] [-h] |
148 |
Options: |
184 |
Options: |
149 |
--enabled Only show instances that are enabled |
185 |
--enabled Show enabled instances |
150 |
--disabled Only show instances that are disabled |
186 |
--disabled Show disabled instances |
151 |
--email Only show instances that have email enabled |
187 |
--email Show instances with email enabled |
152 |
--noemail Only show instances that do not have email enabled |
188 |
--noemail Show instances with email disabled |
153 |
--sip Only show instances that have SIP enabled |
189 |
--sip Show instances with SIP enabled |
154 |
--nosip Only show instances that do not have SIP enabled |
190 |
--nosip Show instances with SIP disabled |
|
|
191 |
--plack Show instances with Plack enabled |
192 |
--noplack Show instances with Plack disabled |
155 |
--help | -h Show this help |
193 |
--help | -h Show this help |
156 |
|
194 |
|
157 |
The filtering options can be combined, and you probably want to do this |
195 |
The filtering options can be combined, and you probably want to do this |
Lines 162-169
EOH
Link Here
|
162 |
show="all" |
200 |
show="all" |
163 |
show_email="all" |
201 |
show_email="all" |
164 |
show_sip="all" |
202 |
show_sip="all" |
|
|
203 |
show_plack="all" |
165 |
|
204 |
|
166 |
args=$(getopt -l help,enabled,disabled,email,noemail,sip,nosip -o h -n $0 -- "$@") |
205 |
args=$(getopt -l help,enabled,disabled,email,noemail,sip,nosip,plack,noplack -o h -n $0 -- "$@") |
167 |
set -- $args |
206 |
set -- $args |
168 |
|
207 |
|
169 |
while [ ! -z "$1" ] |
208 |
while [ ! -z "$1" ] |
Lines 174-179
do
Link Here
|
174 |
--noemail) set_show_email "disabled" ;; |
213 |
--noemail) set_show_email "disabled" ;; |
175 |
--sip) set_show_sip "enabled" ;; |
214 |
--sip) set_show_sip "enabled" ;; |
176 |
--nosip) set_show_sip "disabled" ;; |
215 |
--nosip) set_show_sip "disabled" ;; |
|
|
216 |
--plack) set_show_plack "enabled" ;; |
217 |
--noplack) set_show_plack "disabled" ;; |
177 |
--enabled) set_show "enabled" ;; |
218 |
--enabled) set_show "enabled" ;; |
178 |
--disabled) set_show "disabled" ;; |
219 |
--disabled) set_show "disabled" ;; |
179 |
*) break;; |
220 |
*) break;; |
180 |
- |
|
|