Introducing v-change-vesta-port

This commit is contained in:
myvesta 2019-08-24 02:00:22 +02:00
commit 6343b3e20d
3 changed files with 49 additions and 0 deletions

0
bin/v-add-letsencrypt-user Normal file → Executable file
View file

49
bin/v-change-vesta-port Executable file
View file

@ -0,0 +1,49 @@
#!/bin/bash
# info: change vesta port
# options: port
#
# Function change vesta port
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
whoami=$(whoami)
if [ "$whoami" != "root" ] && [ "$whoami" != "admin" ] ; then
echo "You must be root or admin to execute this script";
exit 1;
fi
# 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
sed -i "s|$oldport;|$port;|g" /usr/local/vesta/nginx/conf/nginx.conf
sed -i "s|'$oldport'|'$port'|g" /etc/roundcube/plugins/password/config.inc.php
sed -i "s|'$oldport'|'$port'|g" /usr/local/vesta/data/firewall/rules.conf
$VESTA/bin/v-update-firewall
systemctl restart fail2ban.service
systemctl restart vesta
echo "$port" > $VESTA/conf/port.conf
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
# Logging
log_event "$OK" "$ARGUMENTS"
exit 0;

0
bin/v-list-sys-config Normal file → Executable file
View file