| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- #!/bin/bash
- # info: delete database server
- # options: TYPE HOST
- #
- # The function for deleting the database host from vesta configuration. It will
- # be deleted if there are no databases created on it only.
- #----------------------------------------------------------#
- # Variable&Function #
- #----------------------------------------------------------#
- # Argument defenition
- type=$1
- host=$2
- # Includes
- source $VESTA/conf/vesta.conf
- source $VESTA/func/main.sh
- source $VESTA/func/db.sh
- #----------------------------------------------------------#
- # Verifications #
- #----------------------------------------------------------#
- check_args '2' "$#" 'TYPE HOST'
- validate_format 'type' 'host'
- is_system_enabled "$DB_SYSTEM"
- is_type_valid "$DB_SYSTEM" "$type"
- is_object_valid "../../conf/$type" 'HOST' "$host"
- is_dbhost_free
- #----------------------------------------------------------#
- # Action #
- #----------------------------------------------------------#
- # Deleting server
- sed -i "/HOST='$host' /d" $VESTA/conf/$type.conf
- #----------------------------------------------------------#
- # Vesta #
- #----------------------------------------------------------#
- # Logging
- log_history "deleted $type database server $host" '' 'admin'
- log_event "$OK" "$EVENT"
- exit
|