mirror of
https://github.com/serghey-rodin/vesta.git
synced 2024-12-03 19:00:24 -08:00
51 lines
1.4 KiB
Bash
Executable File
51 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 definition
|
|
type=$1
|
|
host=$2
|
|
|
|
# Includes
|
|
source $VESTA/func/main.sh
|
|
source $VESTA/func/db.sh
|
|
source $VESTA/conf/vesta.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
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
# 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" "$ARGUMENTS"
|
|
|
|
exit
|