Files
VestaCP/bin/v_delete_database_server

50 lines
1.3 KiB
Plaintext
Raw Normal View History

2011-06-14 00:22:25 +03:00
#!/bin/bash
2012-03-27 23:08:44 +03:00
# info: delete database server
2012-01-03 21:47:10 +02:00
# options: type host
2011-12-26 16:22:43 +02:00
#
# The function for deleting the database host from vesta configuration. It will
# be deleted if there are no databases created on it only.
2011-06-14 00:22:25 +03:00
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
# Argument defenition
2011-11-01 12:27:45 +02:00
type=$1
host=$2
2011-06-14 00:22:25 +03:00
2012-04-02 15:17:28 +03:00
# Includes
2012-03-06 22:07:06 +02:00
source $VESTA/conf/vesta.conf
2012-04-30 12:32:11 +03:00
source $VESTA/func/main.sh
2012-03-06 22:07:06 +02:00
source $VESTA/func/db.sh
2011-06-14 00:22:25 +03:00
#----------------------------------------------------------#
# Verifications #
#----------------------------------------------------------#
2012-03-27 23:08:44 +03:00
check_args '2' "$#" "type host"
validate_format 'type' 'host'
is_system_enabled "$DB_SYSTEM"
2012-03-06 22:07:06 +02:00
is_type_valid "$DB_SYSTEM" "$type"
2012-03-27 23:08:44 +03:00
is_object_valid "../../conf/$type" 'HOST' "$host"
is_dbhost_free
2011-06-14 00:22:25 +03:00
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
2012-03-27 23:08:44 +03:00
# Deleting server
sed -i "/HOST='$host' /d" $VESTA/conf/$type.conf
2011-06-14 00:22:25 +03:00
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
# Logging
2012-03-06 22:07:06 +02:00
log_event "$OK" "$EVENT"
2011-06-14 00:22:25 +03:00
2011-11-01 12:27:45 +02:00
exit