Sfoglia il codice sorgente

systemd daemon for sipwitch

Bob Mottram 9 anni fa
parent
commit
2ea490db8e
2 ha cambiato i file con 36 aggiunte e 2 eliminazioni
  1. 31
    2
      src/freedombone
  2. 5
    0
      src/freedombone-upgrade

+ 31
- 2
src/freedombone Vedi File

@@ -8032,7 +8032,7 @@ function install_blog {
8032 8032
     sed -i 's|social.facebook.*|social.facebook = ""|g' /var/www/$FULLBLOG_DOMAIN_NAME/htdocs/config/config.ini
8033 8033
     sed -i 's|social.twitter.*|social.twitter = ""|g' /var/www/$FULLBLOG_DOMAIN_NAME/htdocs/config/config.ini
8034 8034
     sed -i 's|social.google.*|social.google = ""|g' /var/www/$FULLBLOG_DOMAIN_NAME/htdocs/config/config.ini
8035
-    
8035
+
8036 8036
     # create a user password
8037 8037
     get_blog_admin_password
8038 8038
     if [ ! $FULLBLOG_ADMIN_PASSWORD ]; then
@@ -10288,7 +10288,36 @@ function install_sip {
10288 10288
         echo "SIP onion domain:$SIP_ONION_HOSTNAME" >> $COMPLETION_FILE
10289 10289
     fi
10290 10290
 
10291
-    systemctl restart sipwitch
10291
+    systemctl stop sipwitch
10292
+
10293
+    # Note: the existing sipwitch init daemon doesn't appear to work well
10294
+    # so here we replace it with a systemd one
10295
+
10296
+    # remove the original sipwitch daemon if it exists
10297
+    if [ -f /etc/init.d/sipwitch ]; then
10298
+        rm -f /etc/init.d/sipwitch
10299
+    fi
10300
+
10301
+    # daemon
10302
+    echo '[Unit]' > /etc/systemd/system/sipwitch.service
10303
+    echo 'Description=GNU SIP Witch, a SIP telephony service daemon.' >> /etc/systemd/system/sipwitch.service
10304
+    echo 'After=network.target' >> /etc/systemd/system/sipwitch.service
10305
+    echo '' >> /etc/systemd/system/sipwitch.service
10306
+    echo '[Service]' >> /etc/systemd/system/sipwitch.service
10307
+    echo 'Type=simple' >> /etc/systemd/system/sipwitch.service
10308
+    echo 'PIDFile=/var/run/sipwitch/pidfile' >> /etc/systemd/system/sipwitch.service
10309
+    echo 'EnvironmentFile=-/etc/conf.d/sipwitch' >> /etc/systemd/system/sipwitch.service
10310
+    echo 'EnvironmentFile=-/etc/sipwitch.conf' >> /etc/systemd/system/sipwitch.service
10311
+    echo 'EnvironmentFile=-/etc/default/sipwitch' >> /etc/systemd/system/sipwitch.service
10312
+    echo 'ExecStart=/usr/sbin/sipw -f $OPTIONS' >> /etc/systemd/system/sipwitch.service
10313
+    echo 'Restart=always' >> /etc/systemd/system/sipwitch.service
10314
+    echo '' >> /etc/systemd/system/sipwitch.service
10315
+    echo '[Install]' >> /etc/systemd/system/sipwitch.service
10316
+    echo 'WantedBy=multi-user.target' >> /etc/systemd/system/sipwitch.service
10317
+
10318
+    systemctl enable sipwitch
10319
+    systemctl daemon-reload
10320
+    systemctl start sipwitch
10292 10321
 
10293 10322
     if ! grep -q $"SIP Server" /home/$MY_USERNAME/README; then
10294 10323
         echo '' >> /home/$MY_USERNAME/README

+ 5
- 0
src/freedombone-upgrade Vedi File

@@ -152,6 +152,11 @@ if [ -d $PROJECT_DIR ]; then
152 152
     fi
153 153
 fi
154 154
 
155
+# remove the original sipwitch daemon if it exists
156
+if [ -f /etc/init.d/sipwitch ]; then
157
+	rm -f /etc/init.d/sipwitch
158
+fi
159
+
155 160
 echo '
156 161
 
157 162
 ' | reset-tripwire