You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
1.6 KiB
55 lines
1.6 KiB
#!/bin/bash
|
|
# info: change IP name
|
|
# options: IP NAME
|
|
#
|
|
# example: v-change-sys-ip-name 203.0.113.1 acme.com
|
|
#
|
|
# This function for changing dns domain associated with IP.
|
|
|
|
#----------------------------------------------------------#
|
|
# Variables & Functions #
|
|
#----------------------------------------------------------#
|
|
|
|
# Argument definition
|
|
ip="$1"
|
|
ip_name="$2"
|
|
|
|
# Includes
|
|
# shellcheck source=/etc/hestiacp/hestia.conf
|
|
source /etc/hestiacp/hestia.conf
|
|
# shellcheck source=/usr/local/hestia/func/main.sh
|
|
source $HESTIA/func/main.sh
|
|
# shellcheck source=/usr/local/hestia/func/ip.sh
|
|
source $HESTIA/func/ip.sh
|
|
# load config file
|
|
source_conf "$HESTIA/conf/hestia.conf"
|
|
|
|
#----------------------------------------------------------#
|
|
# Verifications #
|
|
#----------------------------------------------------------#
|
|
|
|
check_args '2' "$#" 'IP IP_NAME'
|
|
is_format_valid 'ip'
|
|
is_format_valid 'ip_name'
|
|
is_ip_valid "$ip"
|
|
|
|
# Perform verification if read-only mode is enabled
|
|
check_hestia_demo_mode
|
|
|
|
#----------------------------------------------------------#
|
|
# Action #
|
|
#----------------------------------------------------------#
|
|
|
|
# Changing IP name
|
|
update_ip_value '$NAME' "$ip_name"
|
|
|
|
#----------------------------------------------------------#
|
|
# Hestia #
|
|
#----------------------------------------------------------#
|
|
|
|
# Logging
|
|
$BIN/v-log-action "system" "Info" "System" "Changed associated DNS on $ip to $ip_name."
|
|
log_event "$OK" "$ARGUMENTS"
|
|
|
|
exit
|