|
@@ -74,10 +74,12 @@ fi
|
74
|
74
|
|
75
|
75
|
##
|
76
|
76
|
if [[ $opt != "nginx" ]] || [[ "$opt" == "apache" ]]; then
|
77
|
|
- find $sites_apache/* -maxdepth 0 -type l -printf '%f\n' >$tmp_dir/active_sites.inf;
|
|
77
|
+ find $sites_apache/* -maxdepth 0 -type l -printf '%f\n' >$tmp_dir/active_sites.inf 2>/dev/null;
|
|
78
|
+ get_tools[${#get_tools[@]}]="apache2";
|
78
|
79
|
fi
|
79
|
80
|
if [[ $opt != "apache" ]] || [[ "$opt" == "nginx" ]]; then
|
80
|
|
- find $sites_nginx/* -maxdepth 0 -type l -printf '%f\n' >$tmp_dir/active_sites.inf;
|
|
81
|
+ find $sites_nginx/* -maxdepth 0 -type l -printf '%f\n' >$tmp_dir/active_sites.inf 2>/dev/null;
|
|
82
|
+ get_tools[${#get_tools[@]}]="nginx";
|
81
|
83
|
fi
|
82
|
84
|
}
|
83
|
85
|
|
|
@@ -124,24 +126,39 @@ for ((xd=0; xd != ${#domains[@]}; xd++)); do
|
124
|
126
|
site_name="${site_data[0]}";
|
125
|
127
|
site_owner="${site_data[1]}";
|
126
|
128
|
site_port="${site_data[2]}";
|
127
|
|
- if [[ "$mode" !="" ]] || [[ "$mode" == "create"]]; then
|
128
|
|
- echo
|
129
|
|
- fi
|
130
|
|
- if [[ "$mode" !="" ]] || [[ "$mode" == "update"]]; then
|
|
129
|
+ case "$cmd" in
|
|
130
|
+ ## create cert
|
|
131
|
+ "--create" | "--create" )
|
|
132
|
+ echo "ok1"
|
|
133
|
+ ;;
|
|
134
|
+
|
|
135
|
+ ## create cert
|
|
136
|
+ "--update" | "--update" )
|
|
137
|
+ echo "ok2"
|
|
138
|
+ ;;
|
|
139
|
+
|
|
140
|
+ ## create cert
|
|
141
|
+ "--flist" | "--flist" )
|
|
142
|
+ echo "ok3"
|
|
143
|
+ ;;
|
|
144
|
+
|
|
145
|
+ ## start defaults
|
|
146
|
+ * )
|
|
147
|
+ reports=()
|
|
148
|
+ reports[${#reports[@]}]="error option!"
|
|
149
|
+ makeErr;
|
|
150
|
+ ;;
|
|
151
|
+ esac
|
131
|
152
|
|
132
|
|
- fi
|
133
|
|
- if [[ "$mode" !="" ]] || [[ "$mode" == "flist"]]; then
|
134
|
|
-
|
135
|
|
- fi
|
136
|
153
|
done
|
137
|
154
|
|
138
|
155
|
## if event - yes
|
139
|
156
|
if [ $event_sw != 0 ];then
|
140
|
|
- :>/etc/ssl/crt-list.txt
|
141
|
|
- for ((icrt=0; icrt != ${#domains[@]}; icrt++))
|
142
|
|
- do
|
143
|
|
- echo "$path_ssl/${domains[$icrt]}.pem">>/etc/ssl/crt-list.txt
|
144
|
|
- done
|
|
157
|
+ echo>/etc/ssl/crt-list.txt
|
|
158
|
+ for ((xt=0; xt != ${#domains[@]}; xt++)); do
|
|
159
|
+ local site_data=( $(echo -e ${domains[$xt]}|sed 's/ /\n /g') );
|
|
160
|
+ echo "$path_ssl/${site_data[0]}.pem">>/etc/ssl/crt-list.txt
|
|
161
|
+ done
|
145
|
162
|
fi
|
146
|
163
|
}
|
147
|
164
|
|
|
@@ -201,59 +218,17 @@ echo "avto4certbot.sh --update; update certificates or --update [apache & nginx]
|
201
|
218
|
echo "avto4certbot.sh --flist; update certificates from ssl or --flist [apache & nginx]; rescan list certificates;"
|
202
|
219
|
echo "avto4certbot.sh --help; this help"
|
203
|
220
|
echo "* examples:"
|
204
|
|
-echo "avtocertbot.sh --test apache"
|
205
|
|
-echo "or"
|
206
|
|
-echo "avtocertbot.sh --test nginx"
|
|
221
|
+echo " avtocertbot.sh --update apache"
|
|
222
|
+echo " or"
|
|
223
|
+echo " avtocertbot.sh --update nginx"
|
207
|
224
|
}
|
208
|
225
|
|
209
|
|
-case "$cmd" in
|
210
|
|
-
|
211
|
|
-## create cert
|
212
|
|
-"--create" | "--create" )
|
213
|
|
-if [ "$opt" != "" ]]; then
|
214
|
|
- mode="create";
|
215
|
|
- execTask;
|
216
|
|
-else
|
217
|
|
- echo "no parameter specified - nginx or apache?"
|
218
|
|
-fi
|
219
|
|
-;;
|
220
|
|
-
|
221
|
|
-## update cert
|
222
|
|
-"--update" | "--update" )
|
223
|
|
-if [ "$opt" != "" ]]; then
|
224
|
|
- mode="update";
|
225
|
|
- execTask;
|
226
|
|
-else
|
227
|
|
- echo "no parameter specified - nginx or apache?"
|
228
|
|
-fi
|
229
|
|
-;;
|
230
|
|
-
|
231
|
|
-## update cert
|
232
|
|
-"--test" | "--test" )
|
233
|
|
-if [ "$opt" != "" ]]; then
|
234
|
|
- mode="test";
|
235
|
|
- execTask;
|
236
|
|
-else
|
237
|
|
- echo "no parameter specified - nginx or apache?"
|
238
|
|
-fi
|
239
|
|
-;;
|
240
|
|
-
|
241
|
|
-## update cert force
|
242
|
|
-"--flist" | "--flist" )
|
243
|
|
-if [ "$opt" != "" ]]; then
|
244
|
|
- mode="flist";
|
|
226
|
+if [ "$opt" != "" ]; then
|
|
227
|
+ getInfo;
|
|
228
|
+ checkDep;
|
245
|
229
|
execTask;
|
246
|
230
|
else
|
247
|
|
- echo "no parameter specified - nginx or apache?"
|
|
231
|
+ pHelp;
|
248
|
232
|
fi
|
249
|
|
-;;
|
250
|
|
-
|
251
|
|
-## start defaults
|
252
|
|
-
|
253
|
|
-* )
|
254
|
|
-checkDep;
|
255
|
|
-pHelp;
|
256
|
|
-;;
|
257
|
|
-esac
|
258
|
233
|
|
259
|
|
-exit
|
|
234
|
+exit
|