Browse Source

add systemd to letsencrypt installer (#8289)

* add systemd to letsencrypt

* Better readability of systemd change

Co-authored-by: Sebastian Feustel <sebastian.feustel@aei.mpg.de>
master
53845714nF 4 years ago
parent
commit
f82088fb8f
No account linked to committer's email address
1 changed files with 19 additions and 6 deletions
  1. 19
    6
      resources/install-letsencrypt-cert.sh

+ 19
- 6
resources/install-letsencrypt-cert.sh View File

@@ -95,9 +95,16 @@ if [ -f /etc/nginx/sites-enabled/$DOMAIN.conf ] ; then
95 95
     CERT_CRT_ESC=$(echo $CERT_CRT_ESC | sed 's/\//\\\//g')
96 96
     sed -i "s/ssl_certificate\ \/etc\/jitsi\/meet\/.*crt/ssl_certificate\ $CERT_CRT_ESC/g" \
97 97
         $CONF_FILE
98
-
99
-    echo "service nginx reload" >> $CRON_FILE
100
-    service nginx reload
98
+    
99
+    if type service >/dev/null 2>&1
100
+    then 
101
+        service nginx reload
102
+        echo "service nginx reload" >> $CRON_FILE
103
+    else 
104
+        systemctl reload nginx.service 
105
+        echo "systemctl reload nginx.service" >> $CRON_FILE
106
+    fi
107
+    
101 108
 elif [ -f /etc/apache2/sites-enabled/$DOMAIN.conf ] ; then
102 109
 
103 110
     /usr/bin/certbot certonly --noninteractive \
@@ -116,9 +123,15 @@ elif [ -f /etc/apache2/sites-enabled/$DOMAIN.conf ] ; then
116 123
     CERT_CRT_ESC=$(echo $CERT_CRT_ESC | sed 's/\//\\\//g')
117 124
     sed -i "s/SSLCertificateFile\ \/etc\/jitsi\/meet\/.*crt/SSLCertificateFile\ $CERT_CRT_ESC/g" \
118 125
         $CONF_FILE
119
-
120
-    echo "service apache2 reload" >> $CRON_FILE
121
-    service apache2 reload
126
+    
127
+    if type service >/dev/null 2>&1
128
+    then 
129
+        service apache2 reload
130
+        echo "service apache2 reload" >> $CRON_FILE
131
+    else 
132
+        systemctl reload apache2.service 
133
+        echo "systemctl reload apache2.service" >> $CRON_FILE
134
+    fi
122 135
 fi
123 136
 
124 137
 # the cron file that will renew certificates

Loading…
Cancel
Save