--- /dev/null
+#!/bin/sh
+set -e
+# Heavily inspired by <https://docs.pleroma.social/backup.html>
+
+service pleroma stop
+su postgres -lc 'pg_dump -d pleroma --format=custom -f /tmp/pleroma.pgdump'
+cd /tmp
+mkdir pleroma_backup
+mv pleroma.pgdump pleroma_backup
+cp -a /var/lib/pleroma/uploads pleroma_backup/uploads
+cp -a /etc/pleroma pleroma_backup/etc_files
+tar cf pleroma_backup.tar pleroma_backup
+chown plom:plom pleroma_backup.tar
+mv pleroma_backup.tar /home/plom/
+service pleroma start
--- /dev/null
+#!/bin/sh
+set -e
+# Heavily inspired by <https://docs.pleroma.social/backup.html>
+
+service pleroma stop
+mv /home/plom/pleroma_backup.tar /tmp/
+cd /tmp
+tar xf pleroma_backup.tar
+cp -a pleroma_backup/uploads/* /var/lib/pleroma/uploads/
+cp -a pleroma_backup/etc_files/* /etc/pleroma/
+su postgres -lc 'pg_restore --clean -d pleroma -v -1 /tmp/pleroma_backup/pleroma.pgdump'
+service pleroma start