diff options
| author | somebodywashere <68244480+somebodywashere@users.noreply.github.com> | 2025-03-18 15:47:58 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-03-18 15:47:58 +0300 |
| commit | fa5fb927c1fbe4dc969a2f804ea89a9511bede9c (patch) | |
| tree | f8f212fed41e1a49f891696cb8c86e97d2c9f80e | |
| parent | f7198c4c2f8111171832be3f470d952d742e5d6c (diff) | |
Update to regular cert issue (#2790)
| -rw-r--r-- | x-ui.sh | 40 |
1 files changed, 34 insertions, 6 deletions
@@ -1136,10 +1136,36 @@ ssl_cert_issue() { LOGE "Issuing certificate succeeded, installing certificates..." fi + reloadCmd="x-ui restart" + + LOGI "Default --reloadcmd for ACME is: ${yellow}x-ui restart" + LOGI "This command will run on every certificate issue and renew." + read -p "Would you like to modify --reloadcmd for ACME? (y/n): " setReloadcmd + if [[ "$setReloadcmd" == "y" || "$setReloadcmd" == "Y" ]]; then + echo -e "\n${green}\t1.${plain} Preset: systemctl reload nginx ; x-ui restart" + echo -e "${green}\t2.${plain} Input your own command" + echo -e "${green}\t0.${plain} Keep default reloadcmd" + read -p "Choose an option: " choice + case "$choice" in + 1) + LOGI "Reloadcmd is: systemctl reload nginx ; x-ui restart" + reloadCmd="systemctl reload nginx ; x-ui restart" + ;; + 2) + LOGD "It's recommended to put x-ui restart at the end, so it won't raise an error if other services fails" + read -p "Please enter your reloadcmd (example: systemctl reload nginx ; x-ui restart): " reloadCmd + LOGI "Your reloadcmd is: ${reloadCmd}" + ;; + *) + LOGI "Keep default reloadcmd" + ;; + esac + fi + # install the certificate ~/.acme.sh/acme.sh --installcert -d ${domain} \ --key-file /root/cert/${domain}/privkey.pem \ - --fullchain-file /root/cert/${domain}/fullchain.pem + --fullchain-file /root/cert/${domain}/fullchain.pem --reloadcmd "${reloadCmd}" if [ $? -ne 0 ]; then LOGE "Installing certificate failed, exiting." @@ -1261,17 +1287,18 @@ ssl_cert_issue_CF() { LOGI "This command will run on every certificate issue and renew." read -p "Would you like to modify --reloadcmd for ACME? (y/n): " setReloadcmd if [[ "$setReloadcmd" == "y" || "$setReloadcmd" == "Y" ]]; then - echo -e "\n${green}\t1.${plain} Preset: x-ui restart ; systemctl reload nginx" + echo -e "\n${green}\t1.${plain} Preset: systemctl reload nginx ; x-ui restart" echo -e "${green}\t2.${plain} Input your own command" echo -e "${green}\t0.${plain} Keep default reloadcmd" read -p "Choose an option: " choice case "$choice" in 1) - LOGI "Reloadcmd is: x-ui restart ; systemctl reload nginx" - reloadCmd="x-ui restart ; systemctl reload nginx" + LOGI "Reloadcmd is: systemctl reload nginx ; x-ui restart" + reloadCmd="systemctl reload nginx ; x-ui restart" ;; - 2) - read -p "Please enter your reloadcmd (example: x-ui restart ; systemctl reload nginx): " reloadCmd + 2) + LOGD "It's recommended to put x-ui restart at the end, so it won't raise an error if other services fails" + read -p "Please enter your reloadcmd (example: systemctl reload nginx ; x-ui restart): " reloadCmd LOGI "Your reloadcmd is: ${reloadCmd}" ;; *) @@ -1282,6 +1309,7 @@ ssl_cert_issue_CF() { ~/.acme.sh/acme.sh --installcert -d ${CF_Domain} -d *.${CF_Domain} \ --key-file ${certPath}/privkey.pem \ --fullchain-file ${certPath}/fullchain.pem --reloadcmd "${reloadCmd}" + if [ $? -ne 0 ]; then LOGE "Certificate installation failed, script exiting..." exit 1 |
