From 4243491f831532de8bcac9d68a272e7fef5269ee Mon Sep 17 00:00:00 2001 From: SevicheCC <91365763+Sevichecc@users.noreply.github.com> Date: Sun, 22 Jan 2023 00:42:30 +0800 Subject: [PATCH] Create backup.sh --- backup.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 backup.sh diff --git a/backup.sh b/backup.sh new file mode 100644 index 0000000..ebc28a8 --- /dev/null +++ b/backup.sh @@ -0,0 +1,17 @@ +#!/bin/bash +source /etc/profile +source ./.env + +echo `date +"%Y-%m-%d %H:%M:%S"` " now starting backup" +echo "————————————backup to local directory——————————" +echo "1.dump database" +sudo -Hu postgres pg_dump -d $PLEROMA_DB --format=custom -f ${BACKUP_PATH}/pleroma.pgdump + +echo "2.copy upload & static folder" +cp -r ${PLEROMA_PATH}/static ${BACKUP_PATH} +cp -r ${PLEROMA_PATH}/uploads ${BACKUP_PATH} + +echo "3.copy config file" +cp ${PLEROMA_CONFIG_PATH} ${BACKUP_PATH} + +echo `date +"%Y-%m-%d %H:%M:%S"` " done!"