Created
November 22, 2020 08:09
-
-
Save Coro365/c18588b0aeb7f72ffe49b8065d875d02 to your computer and use it in GitHub Desktop.
Backup pleroma instance
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local_path="/home/pi/Documents/pleroma-backup" | |
remote="zunda" | |
remote_path="/Users/coro/Documents/pleroma-backup" | |
today=`date "+%Y%m%d-%H%M%S"` | |
pgdp_path=""$local_path"/plbk-"$today".pgdump" | |
sftp_path=""$local_path"/sftp.bat" | |
echo "Backup pg" | |
sudo -Hu postgres pg_dump -d pleroma --format=custom -f "$pgdp_path" | |
echo "Create SFTP bat file" | |
touch "$sftp_path" | |
echo "cd "$remote_path"\nput "$pgdp_path"\nquit" > $sftp_path | |
echo "Transport to $remote" | |
sftp -b $sftp_path $remote | |
echo "Delete temp file" | |
rm $sftp_path | |
sudo rm $pgdp_path | |
echo "Backup complete" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment