From e902b0180b6e78c3cc7365ef6f1fee363b6127cf Mon Sep 17 00:00:00 2001 From: dpeca Date: Sat, 24 Aug 2019 15:55:29 +0200 Subject: [PATCH] Update v-change-vesta-port --- bin/v-change-vesta-port | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/bin/v-change-vesta-port b/bin/v-change-vesta-port index 1d96023c..f3951fdc 100755 --- a/bin/v-change-vesta-port +++ b/bin/v-change-vesta-port @@ -15,23 +15,19 @@ 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' $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'