Skip to content

Commit fa5fb92

Browse files
Update to regular cert issue (#2790)
1 parent f7198c4 commit fa5fb92

File tree

1 file changed

+34
-6
lines changed

1 file changed

+34
-6
lines changed

x-ui.sh

+34-6
Original file line numberDiff line numberDiff line change
@@ -1136,10 +1136,36 @@ ssl_cert_issue() {
11361136
LOGE "Issuing certificate succeeded, installing certificates..."
11371137
fi
11381138

1139+
reloadCmd="x-ui restart"
1140+
1141+
LOGI "Default --reloadcmd for ACME is: ${yellow}x-ui restart"
1142+
LOGI "This command will run on every certificate issue and renew."
1143+
read -p "Would you like to modify --reloadcmd for ACME? (y/n): " setReloadcmd
1144+
if [[ "$setReloadcmd" == "y" || "$setReloadcmd" == "Y" ]]; then
1145+
echo -e "\n${green}\t1.${plain} Preset: systemctl reload nginx ; x-ui restart"
1146+
echo -e "${green}\t2.${plain} Input your own command"
1147+
echo -e "${green}\t0.${plain} Keep default reloadcmd"
1148+
read -p "Choose an option: " choice
1149+
case "$choice" in
1150+
1)
1151+
LOGI "Reloadcmd is: systemctl reload nginx ; x-ui restart"
1152+
reloadCmd="systemctl reload nginx ; x-ui restart"
1153+
;;
1154+
2)
1155+
LOGD "It's recommended to put x-ui restart at the end, so it won't raise an error if other services fails"
1156+
read -p "Please enter your reloadcmd (example: systemctl reload nginx ; x-ui restart): " reloadCmd
1157+
LOGI "Your reloadcmd is: ${reloadCmd}"
1158+
;;
1159+
*)
1160+
LOGI "Keep default reloadcmd"
1161+
;;
1162+
esac
1163+
fi
1164+
11391165
# install the certificate
11401166
~/.acme.sh/acme.sh --installcert -d ${domain} \
11411167
--key-file /root/cert/${domain}/privkey.pem \
1142-
--fullchain-file /root/cert/${domain}/fullchain.pem
1168+
--fullchain-file /root/cert/${domain}/fullchain.pem --reloadcmd "${reloadCmd}"
11431169

11441170
if [ $? -ne 0 ]; then
11451171
LOGE "Installing certificate failed, exiting."
@@ -1261,17 +1287,18 @@ ssl_cert_issue_CF() {
12611287
LOGI "This command will run on every certificate issue and renew."
12621288
read -p "Would you like to modify --reloadcmd for ACME? (y/n): " setReloadcmd
12631289
if [[ "$setReloadcmd" == "y" || "$setReloadcmd" == "Y" ]]; then
1264-
echo -e "\n${green}\t1.${plain} Preset: x-ui restart ; systemctl reload nginx"
1290+
echo -e "\n${green}\t1.${plain} Preset: systemctl reload nginx ; x-ui restart"
12651291
echo -e "${green}\t2.${plain} Input your own command"
12661292
echo -e "${green}\t0.${plain} Keep default reloadcmd"
12671293
read -p "Choose an option: " choice
12681294
case "$choice" in
12691295
1)
1270-
LOGI "Reloadcmd is: x-ui restart ; systemctl reload nginx"
1271-
reloadCmd="x-ui restart ; systemctl reload nginx"
1296+
LOGI "Reloadcmd is: systemctl reload nginx ; x-ui restart"
1297+
reloadCmd="systemctl reload nginx ; x-ui restart"
12721298
;;
1273-
2)
1274-
read -p "Please enter your reloadcmd (example: x-ui restart ; systemctl reload nginx): " reloadCmd
1299+
2)
1300+
LOGD "It's recommended to put x-ui restart at the end, so it won't raise an error if other services fails"
1301+
read -p "Please enter your reloadcmd (example: systemctl reload nginx ; x-ui restart): " reloadCmd
12751302
LOGI "Your reloadcmd is: ${reloadCmd}"
12761303
;;
12771304
*)
@@ -1282,6 +1309,7 @@ ssl_cert_issue_CF() {
12821309
~/.acme.sh/acme.sh --installcert -d ${CF_Domain} -d *.${CF_Domain} \
12831310
--key-file ${certPath}/privkey.pem \
12841311
--fullchain-file ${certPath}/fullchain.pem --reloadcmd "${reloadCmd}"
1312+
12851313
if [ $? -ne 0 ]; then
12861314
LOGE "Certificate installation failed, script exiting..."
12871315
exit 1

0 commit comments

Comments
 (0)