| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- #!/bin/bash
- # info: delete database server
- # options: TYPE HOST
- # labels:
- #
- # example: v-delete-database-host pgsql localhost
- #
- # The function for deleting the database host from hestia configuration. It will
- # be deleted if there are no databases created on it only.
- #----------------------------------------------------------#
- # Variable&Function #
- #----------------------------------------------------------#
- # Argument definition
- type=$1
- host=$2
- # Includes
- source $HESTIA/func/main.sh
- source $HESTIA/func/db.sh
- source $HESTIA/conf/hestia.conf
- #----------------------------------------------------------#
- # Verifications #
- #----------------------------------------------------------#
- check_args '2' "$#" 'TYPE HOST'
- is_format_valid 'type' 'host'
- is_system_enabled "$DB_SYSTEM" 'DB_SYSTEM'
- is_type_valid "$DB_SYSTEM" "$type"
- is_object_valid "../../conf/$type" 'HOST' "$host"
- is_dbhost_free
- # Perform verification if read-only mode is enabled
- check_hestia_demo_mode
- #----------------------------------------------------------#
- # Action #
- #----------------------------------------------------------#
- # Deleting server
- sed -i "/HOST='$host' /d" $HESTIA/conf/$type.conf
- #----------------------------------------------------------#
- # Hestia #
- #----------------------------------------------------------#
- # Logging
- log_history "deleted $type database server $host" '' 'admin'
- log_event "$OK" "$ARGUMENTS"
- exit
|