add backup timer
This commit is contained in:
parent
ccbde02107
commit
e3ae1367d6
5 changed files with 33 additions and 0 deletions
7
db/reload.sh
Executable file
7
db/reload.sh
Executable file
|
|
@ -0,0 +1,7 @@
|
||||||
|
#!/bin/sh
|
||||||
|
pandoractl stop
|
||||||
|
sudo -H -u postgres dropdb pandora
|
||||||
|
sudo -H -u postgres createdb -T template0 --locale=C --encoding=UTF8 -O pandora pandora
|
||||||
|
zcat /srv/pandora/data/db/latest.psql.gz | pandoractl manage dbshell
|
||||||
|
pandoractl start
|
||||||
|
|
||||||
5
db/sync_pandora.sh
Executable file
5
db/sync_pandora.sh
Executable file
|
|
@ -0,0 +1,5 @@
|
||||||
|
#!/bin/bash
|
||||||
|
rsync -avP time:/srv/pandora/data/ /srv/pandora/data/
|
||||||
|
bash /srv/pandora/data/db/reload.sh
|
||||||
|
rsync -avP time:/srv/pandora/data/ /srv/pandora/data/ --delete
|
||||||
|
pandoractl manage generate_clips
|
||||||
4
db/update.sh
Executable file
4
db/update.sh
Executable file
|
|
@ -0,0 +1,4 @@
|
||||||
|
#!/bin/bash
|
||||||
|
cd /srv/pandora/data/db
|
||||||
|
pg_dump pandora | gzip > pandora-`date -I`.psql.gz
|
||||||
|
ln -sf pandora-`date -I`.psql.gz latest.psql.gz
|
||||||
8
etc/systemd/system/pandora-backup-db.service
Normal file
8
etc/systemd/system/pandora-backup-db.service
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
Unit]
|
||||||
|
Description=Backup pandora database
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
User=pandora
|
||||||
|
Group=pandora
|
||||||
|
ExecStart=/srv/pandora/db/update.sh
|
||||||
9
etc/systemd/system/pandora-backup-db.timer
Normal file
9
etc/systemd/system/pandora-backup-db.timer
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
[Unit]
|
||||||
|
Description=Backup pandora database
|
||||||
|
|
||||||
|
[Timer]
|
||||||
|
OnCalendar=*-*-* 4:00
|
||||||
|
Persistent=true
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=timers.target
|
||||||
Loading…
Add table
Add a link
Reference in a new issue