| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- #!/bin/bash
- # info: change ip status
- # options: IPV6 IP_STATUS
- #
- # The function of changing an ip address's status.
- #----------------------------------------------------------#
- # Variable&Function #
- #----------------------------------------------------------#
- # Argument definition
- ipv6=$1
- ip_status=$2
- # Includes
- source $HESTIA/func/main.sh
- source $HESTIA/func/ipv6.sh
- source $HESTIA/conf/hestia.conf
- #----------------------------------------------------------#
- # Verifications #
- #----------------------------------------------------------#
- check_args '2' "$#" 'IPV6 IP_STATUS'
- is_format_valid 'ipv6' 'ip_status'
- is_ipv6_valid "$ipv6"
- if [ "$ip_status" = "$(get_ipv6_value '$STATUS')" ]; then
- check_result "$E_EXISTS" "status $ip_status is already set"
- fi
- web_domains=$(get_ipv6_value '$U_WEB_DOMAINS')
- sys_user=$(get_ipv6_value '$U_SYS_USERS')
- ip_owner=$(get_ipv6_value '$OWNER')
- if [ "$web_domains" -ne '0' ] && [ "$sys_user" != "$ip_owner" ]; then
- check_result "$E_INUSE" "ip $ipv6 is used"
- fi
- #----------------------------------------------------------#
- # Action #
- #----------------------------------------------------------#
- # Changing ip name
- update_ipv6_value '$STATUS' "$ip_status"
- #----------------------------------------------------------#
- # Hestia #
- #----------------------------------------------------------#
- # Logging
- log_history "changed $ipv6 status to $ip_status" '' 'admin'
- log_event "$OK" "$ARGUMENTS"
- exit
|