myvesta/bin/v-change-sys-ip-name
2017-07-07 18:33:23 +02:00

49 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
# info: change ip name
# options: IP NAME
#
# The function for changing dns domain associated with ip.
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
# Argument definition
ip=$1
ip_name=$2
# Includes
source $VESTA/func/main.sh
source $VESTA/func/ip.sh
source $VESTA/conf/vesta.conf
#----------------------------------------------------------#
# Verifications #
#----------------------------------------------------------#
check_args '2' "$#" 'IP IP_NAME'
is_format_valid 'ip'
is_format_valid 'ip_name'
is_ip_valid "$ip"
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
# Changing ip name
update_ip_value '$NAME' "$ip_name"
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
# Logging
log_history "changed associated dns on $ip to $ip_name" '' 'admin'
log_event "$OK" "$ARGUMENTS"
exit