Explorar o código

webip upgrade trigger

Serghey Rodin %!s(int64=12) %!d(string=hai) anos
pai
achega
8e1686cbbf
Modificáronse 1 ficheiros con 29 adicións e 0 borrados
  1. 29 0
      upd/convert_webip.sh

+ 29 - 0
upd/convert_webip.sh

@@ -0,0 +1,29 @@
+#!/bin/bash
+
+# Include vesta.conf
+source /usr/local/vesta/conf/vesta.conf
+
+# Remove ol ip definitions from vesta.conf
+sed -i "/^Listen/d" /etc/$WEB_SYSTEM/conf.d/vesta.conf
+sed -i "/^NameVirtualHost/d" /etc/$WEB_SYSTEM/conf.d/vesta.conf
+sed -i "/^$/d" /etc/$WEB_SYSTEM/conf.d/vesta.conf
+
+# Create new ip configs
+for ip in $(ls /usr/local/vesta/data/ips); do
+    web_conf="/etc/$WEB_SYSTEM/conf.d/$ip.conf"
+
+    if [ "$WEB_SYSTEM" = 'httpd' ] || [ "$WEB_SYSTEM" = 'apache2' ]; then
+        echo "NameVirtualHost $ip:$WEB_PORT" >  $web_conf
+        echo "Listen $ip:$WEB_PORT" >> $web_conf
+    fi
+
+    if [ "$WEB_SSL" = 'mod_ssl' ]; then
+        echo "NameVirtualHost $ip:$WEB_SSL_PORT" >> $web_conf
+        echo "Listen $ip:$WEB_SSL_PORT" >> $web_conf
+    fi
+done
+
+# Restart web server
+/usr/local/vesta/bin/v-restart-web
+
+exit