aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/hydra/backup33
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"