2012-02-16 01:25:03 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
# info: delete user databases
|
|
|
|
|
# options: user
|
|
|
|
|
#
|
|
|
|
|
# The function deletes all user databases.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
|
|
|
# Variable&Function #
|
|
|
|
|
#----------------------------------------------------------#
|
|
|
|
|
|
|
|
|
|
# Argument defenition
|
|
|
|
|
user=$1
|
|
|
|
|
|
2012-03-27 23:08:44 +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-02-16 01:25:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
|
|
|
# Verifications #
|
|
|
|
|
#----------------------------------------------------------#
|
|
|
|
|
|
|
|
|
|
check_args '1' "$#" 'user'
|
2012-03-06 22:07:06 +02:00
|
|
|
validate_format 'user'
|
2012-03-27 23:08:44 +03:00
|
|
|
is_system_enabled "$DB_SYSTEM"
|
2012-03-06 22:07:06 +02:00
|
|
|
is_object_valid 'user' 'USER' "$user"
|
2012-03-27 23:08:44 +03:00
|
|
|
is_object_unsuspended 'user' 'USER' "$user"
|
2012-02-16 01:25:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
|
|
|
# Action #
|
|
|
|
|
#----------------------------------------------------------#
|
|
|
|
|
|
|
|
|
|
# Starting delete loop
|
2012-03-27 23:08:44 +03:00
|
|
|
for database in $(search_objects 'db' 'SUSPENDED' "no" 'DB'); do
|
2012-11-09 18:26:32 +02:00
|
|
|
$BIN/v-delete-database "$user" "$database"
|
2012-02-16 01:25:03 +02:00
|
|
|
done
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
|
|
|
# Vesta #
|
|
|
|
|
#----------------------------------------------------------#
|
|
|
|
|
|
|
|
|
|
# Logging
|
2012-03-06 22:07:06 +02:00
|
|
|
log_event "$OK" "$EVENT"
|
2012-02-16 01:25:03 +02:00
|
|
|
|
|
|
|
|
exit
|