diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2012-06-28 12:54:31 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2012-06-28 12:54:31 -0300 |
commit | a58fa1d4a75b8a3263e8d039106c47d9c8452a70 (patch) | |
tree | cba39c1e71b28e181a72d723f07b30f731e0a066 /lib | |
parent | a7bb43458ea3a6b7cc367a35013af8c313f4fef4 (diff) | |
download | hydra-a58fa1d4a75b8a3263e8d039106c47d9c8452a70.tar.gz hydra-a58fa1d4a75b8a3263e8d039106c47d9c8452a70.tar.bz2 |
Unifying service restoration with hydra_backup_environment_service
Diffstat (limited to 'lib')
-rw-r--r-- | lib/hydra/backup | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/lib/hydra/backup b/lib/hydra/backup index 0209570..9ac6833 100644 --- a/lib/hydra/backup +++ b/lib/hydra/backup @@ -88,6 +88,39 @@ function hydra_backup_environment_remote { mkdir -p $RESTOREDIR } +# Setup environment for the backups for a service +function hydra_backup_environment_service { + # Check restore strategy. + if [ "$HOST" == "localhost" ] || [ "$HOST" == "`facter hostname`" ]; then + hydra_backup_environment_local + else + hydra_backup_environment_remote $HOST restore + fi + + # Check if folder exist on the backup. + if [ ! -d "$RESTOREDIR/$SERVICE_DIR" ]; then + echo "Service folder does not exist: $RESTOREDIR/$SERVICE_DIR" + exit 1 + fi + + # Set user. + if hydra_check_user $SERVICE_USER; then + SERVICE_USER="$SERVICE_USER" + else + SERVICE_USER="root" + fi + + # Set group. + if hydra_check_group $SERVICE_GROUP; then + SERVICE_GROUP="$SERVICE_GROUP" + else + SERVICE_GROUP="root" + fi + + # TODO: Backup it? + #hydractl backup-$SERVICE +} + # Restore a database function hydra_backup_restore_database { DATABASE="$1" |