dpeca 6 лет назад
Родитель
Сommit
5a58fcfe6e
1 измененных файлов с 6 добавлено и 14 удалено
  1. 6 14
      bin/v-change-vesta-port

+ 6 - 14
bin/v-change-vesta-port

@@ -11,27 +11,19 @@
 # Argument definition
 port=$1
 
-if [ -z "$VESTA" ]; then
-    VESTA="/usr/local/vesta"
-fi
-
-if [ ! -f "$VESTA/conf/port.conf" ]; then
+# Get current vesta port by reading nginx.conf
+oldport=$(grep 'listen' /usr/local/vesta/nginx/conf/nginx.conf | awk '{print $2}' | sed "s|;||")
+if [ -z "$oldport" ]; then
     oldport=8083
-else
-    oldport=`cat $VESTA/conf/port.conf`
 fi
 
-# Includes
-source $VESTA/func/main.sh
-
 #----------------------------------------------------------#
 #                    Verifications                         #
 #----------------------------------------------------------#
 
-whoami=$(whoami)
-if [ "$whoami" != "root" ] && [ "$whoami" != "admin" ] ; then
-    echo "You must be root or admin to execute this script";
-    exit 1;
+# Checking permissions
+if [ "$(id -u)" != '0' ]; then
+    check_result $E_FORBIDEN "You must be root to execute this script"
 fi
 
 check_args '1' "$#" 'PORT'