mirror of
https://codeberg.org/hyperreal/admin-scripts
synced 2024-11-25 09:03:41 +01:00
Add server0-backup
This commit is contained in:
parent
f587c629e3
commit
a346f8b1c6
@ -1,18 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
set -eu
|
|
||||||
|
|
||||||
trap "mv /home/mastodon/db-backup.sql.temp /home/mastodon/db-backup.sql" SIGHUP SIGINT SIGQUIT SIGTERM
|
|
||||||
trap "rm -v /home/mastodon/db-backup.sql.temp" EXIT
|
|
||||||
|
|
||||||
mv -v /home/mastodon/db-backup.sql /home/mastodon/db-backup.sql.temp
|
|
||||||
|
|
||||||
pg_dump -U mastodon -Fc mastodon_production -p 5432 -f /home/mastodon/db-backup.sql
|
|
||||||
|
|
||||||
rclone sync -c /home/mastodon/live/public/system/ /mnt/mastodon/system
|
|
||||||
|
|
||||||
rclone copy -c /home/mastodon/db-backup.sql /mnt/mastodon
|
|
||||||
|
|
||||||
rclone copy -c /home/mastodon/live/.env.production /mnt/mastodon
|
|
||||||
|
|
||||||
exit 0
|
|
17
bin/server0-backup
Executable file
17
bin/server0-backup
Executable file
@ -0,0 +1,17 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
trap "sudo -u mastodon mv /home/mastodon/db-backup.sql.temp /home/mastodon/db-backup.sql" SIGHUP SIGINT SIGQUIT SIGTERM
|
||||||
|
trap "rm -v /home/mastodon/db-backup.sql.temp" EXIT
|
||||||
|
|
||||||
|
sudo -u mastodon mv -v /home/mastodon/db-backup.sql /home/mastodon/db-backup.sql.temp
|
||||||
|
sudo -u mastodon pg_dump -U mastodon -Fc mastodon_production -p 5432 -f /home/mastodon/db-backup.sql
|
||||||
|
|
||||||
|
rclone sync -c /etc wasabi:server0-backup/etc/
|
||||||
|
rclone sync -c /var/log wasabi:server0-backup/var-log/
|
||||||
|
rclone sync -c /home/jas wasabi:server0-backup/home-jas/
|
||||||
|
rclone copy -c /home/mastodon/db-backup.sql wasabi:server0-backup/home-mastodon/
|
||||||
|
rclone copy -c /home/mastodon/live/.env.production wasabi:server0-backup/home-mastodon/
|
||||||
|
|
||||||
|
exit 0
|
@ -1,14 +0,0 @@
|
|||||||
[Unit]
|
|
||||||
Description=rsync-backup
|
|
||||||
AssertFileIsExecutable=/usr/local/bin/rsync-backup
|
|
||||||
Requires=mnt-backup.mount
|
|
||||||
After=mnt-backup.mount
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type=oneshot
|
|
||||||
User=root
|
|
||||||
Group=root
|
|
||||||
ExecStart=/usr/local/bin/rsync-backup
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
14
systemd/system/server0-backup.service
Normal file
14
systemd/system/server0-backup.service
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=server0-backup
|
||||||
|
AssertFileIsExecutable=/usr/local/bin/server0-backup
|
||||||
|
Requires=network-online.target
|
||||||
|
After=network-online.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
User=root
|
||||||
|
Group=root
|
||||||
|
ExecStart=/usr/local/bin/server0-backup
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
@ -1,5 +1,5 @@
|
|||||||
[Unit]
|
[Unit]
|
||||||
Description=rsync-backup
|
Description=server0-backup
|
||||||
|
|
||||||
[Timer]
|
[Timer]
|
||||||
OnCalendar=Sun *-*-* 23:30:00
|
OnCalendar=Sun *-*-* 23:30:00
|
Loading…
Reference in New Issue
Block a user