vesta/bin/v-delete-database-server
2012-11-09 18:26:32 +02:00

50 lines
1.4 KiB
Bash
Executable file

#!/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