Skip to content

Commit

Permalink
Cleanup of backup.mk
Browse files Browse the repository at this point in the history
  • Loading branch information
salverius-tech committed Apr 13, 2024
1 parent f81c8bc commit f89e15c
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions make.d/backup.mk
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@
##
#########################################################

$(NFS_BACKUP_TMP_DIR):
sudo mkdir -p $(NFS_BACKUP_TMP_DIR)
sudo mount -t nfs $(NFS_SERVER):$(NFS_BACKUP_PATH) $(NFS_BACKUP_TMP_DIR)

create-backup: backups ## create a backup of the onramp config
sudo tar --exclude=.keep --exclude=etc/plex/Library -czf ./backups/onramp-config-backup-$(HOST_NAME)-$(shell date +'%y-%m-%d-%H%M').tar.gz ./etc ./services-enabled ./overrides-enabled .env || true

create-nfs-backup: create-backup ## create a backup of the onramp config and copy it to the nfs server
sudo mount -t nfs $(NFS_SERVER):$(NFS_BACKUP_PATH) $(NFS_BACKUP_TMP_DIR)
create-nfs-backup: $(NFS_BACKUP_TMP_DIR) create-backup ## create a backup of the onramp config and copy it to the nfs server
sudo mv ./backups/onramp-config-backup* $(NFS_BACKUP_TMP_DIR)
sudo umount $(NFS_BACKUP_TMP_DIR)

Expand All @@ -18,10 +21,6 @@ backups: ## create backups folder
restore-backup: ## restore the latest backup of the onramp config
sudo tar -xvf ./backups/onramp-config-backup-$(HOST_NAME)-*.tar.gz

$(NFS_BACKUP_TMP_DIR):
sudo mkdir -p $(NFS_BACKUP_TMP_DIR)
sudo mount -t nfs $(NFS_SERVER):$(NFS_BACKUP_PATH) $(NFS_BACKUP_TMP_DIR)

restore-nfs-backup: $(NFS_BACKUP_TMP_DIR) backups ## restore the latest backup of the onramp config from the nfs server
$(eval BACKUP_FILE := $(shell find $(NFS_BACKUP_TMP_DIR)/*$(HOST_NAME)* -type f -printf "%T@ %p\n" | sort -n | cut -d' ' -f 2- | tail -n 1))
sudo rm -rf ./backups/*
Expand Down

0 comments on commit f89e15c

Please sign in to comment.