|
@@ -4,7 +4,7 @@
|
4
|
4
|
# license: GPL 2.0
|
5
|
5
|
# create 2022
|
6
|
6
|
#
|
7
|
|
-version="0.3.1";
|
|
7
|
+version="0.3.2";
|
8
|
8
|
sname="avto4certbot";
|
9
|
9
|
# необходимы для работы: nginx,certbot (и если почтовый сервер то сервисы в restartMail)
|
10
|
10
|
# create new cert or update
|
|
@@ -48,7 +48,8 @@ opt=$2;
|
48
|
48
|
#-list enable sites
|
49
|
49
|
scan_list=();
|
50
|
50
|
#
|
51
|
|
-
|
|
51
|
+eval enable_www="(" $(find $nginx_enable/* -maxdepth 0 -type l -printf '%f\n') ")";
|
|
52
|
+#
|
52
|
53
|
#--@F Check the program dependency
|
53
|
54
|
function checkDep() {
|
54
|
55
|
# - msg debug
|
|
@@ -166,8 +167,8 @@ fi
|
166
|
167
|
|
167
|
168
|
function downSite(){
|
168
|
169
|
sudo systemctl stop nginx.service;
|
169
|
|
-
|
170
|
170
|
eval list_www="(" $(find $nginx_enable/* -maxdepth 0 -type l -printf '%f\n') ")";
|
|
171
|
+
|
171
|
172
|
if [ ${#list_www[@]} != 0 ]; then
|
172
|
173
|
for ((dwx=0; dwx != ${#list_www[@]}; dwx++))
|
173
|
174
|
do
|
|
@@ -193,6 +194,14 @@ done
|
193
|
194
|
sudo systemctl start nginx.service;
|
194
|
195
|
}
|
195
|
196
|
|
|
197
|
+function restoreSite() {
|
|
198
|
+sudo systemctl stop nginx.service;
|
|
199
|
+for ((dwx=0; dwx != ${#enable_www[@]}; dwx++))
|
|
200
|
+ do
|
|
201
|
+ ln -s $nginx_available/${enable_www[dwx]} $nginx_enable/${enable_www[dwx]};
|
|
202
|
+done
|
|
203
|
+sudo systemctl start nginx.service;
|
|
204
|
+}
|
196
|
205
|
|
197
|
206
|
function createConf(){
|
198
|
207
|
if [ ! -d $path_tmp ];
|
|
@@ -251,6 +260,8 @@ toSSL;
|
251
|
260
|
downSite;
|
252
|
261
|
if [ "$opt" == "mail" ]; then
|
253
|
262
|
restartMail;
|
|
263
|
+else
|
|
264
|
+restoreSite;
|
254
|
265
|
fi
|
255
|
266
|
|
256
|
267
|
;;
|
|
@@ -265,6 +276,8 @@ toSSL;
|
265
|
276
|
downSite;
|
266
|
277
|
if [ "$opt" == "mail" ]; then
|
267
|
278
|
restartMail;
|
|
279
|
+else
|
|
280
|
+restoreSite;
|
268
|
281
|
fi
|
269
|
282
|
|
270
|
283
|
|
|
@@ -277,7 +290,6 @@ if [ "$opt" == "mail" ]; then
|
277
|
290
|
restartMail;
|
278
|
291
|
fi
|
279
|
292
|
|
280
|
|
-
|
281
|
293
|
;;
|
282
|
294
|
|
283
|
295
|
## start defaults
|