Update v-change-vesta-port

This commit is contained in:
dpeca 2019-08-24 03:35:59 +02:00 committed by GitHub
commit 105f8c2541
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2,11 +2,30 @@
# info: change vesta port # info: change vesta port
# options: port # options: port
# #
# Function change vesta port # Function will change vesta port
#----------------------------------------------------------# #----------------------------------------------------------#
# Variable & Verifications # # Variable&Function #
#----------------------------------------------------------#
# Argument definition
port=$1
if [ -z "$VESTA" ]; then
VESTA="/usr/local/vesta"
fi
if [ ! -f "$VESTA/conf/port.conf" ]; then
oldport=8083
else
oldport=`cat $VESTA/conf/port.conf`
fi
# Includes
source $VESTA/func/main.sh
#----------------------------------------------------------#
# Verifications #
#----------------------------------------------------------# #----------------------------------------------------------#
whoami=$(whoami) whoami=$(whoami)
@ -15,26 +34,8 @@ if [ "$whoami" != "root" ] && [ "$whoami" != "admin" ] ; then
exit 1; exit 1;
fi fi
if [ -z "$VESTA" ]; then check_args '1' "$#" 'PORT'
VESTA="/usr/local/vesta" is_int_format_valid "$port" 'port number'
fi
# Includes
source $VESTA/func/main.sh
# Argument definition
port=$1
re='^[0-9]+$'
if ! [[ $port =~ $re ]] ; then
echo "error: Not a number" >&2; exit 1
fi
if [ ! -f "$VESTA/conf/port.conf" ]; then
oldport=8083
else
oldport=`cat $VESTA/conf/port.conf`
fi
#----------------------------------------------------------# #----------------------------------------------------------#
# Action # # Action #