From d5cc5c5c2f8eb694d538800ec44ba1a0b5f344e0 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Wed, 18 Oct 2023 13:16:59 +0200 Subject: [PATCH] =?UTF-8?q?Ajout=20de=20scripts=20de=20systemd=20pour=20le?= =?UTF-8?q?s=20sauvegardes=20bd,=20et=20modif=20param=C3=A8tres=20par=20de?= =?UTF-8?q?faut=20des=20rotations.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tools/backups/backup_rotation.sh | 8 ++++---- tools/etc/scodoc-backup-db.service | 18 ++++++++++++++++++ tools/etc/scodoc-backup-db.timer | 16 ++++++++++++++++ 3 files changed, 38 insertions(+), 4 deletions(-) create mode 100644 tools/etc/scodoc-backup-db.service create mode 100644 tools/etc/scodoc-backup-db.timer diff --git a/tools/backups/backup_rotation.sh b/tools/backups/backup_rotation.sh index cfab628df..a4b4a826e 100755 --- a/tools/backups/backup_rotation.sh +++ b/tools/backups/backup_rotation.sh @@ -11,10 +11,10 @@ # Must contain backup.monthly backup.weekly backup.daily backup.hourly folders storage="$1" -NB_HOURLY=48 # nb de sauvegardes horaires a conserver (1 par heure) -NB_DAILY=40 # nb de sauvegardes quotidiennes a conserver -NB_WEEKLY=30 # nombre de sauvegardes hebdomadaires a conserver -NB_MONTHLY=200 # nombre de sauvegardes mensuelles a conserver +NB_HOURLY=24 # nb de sauvegardes horaires a conserver (1 par heure) +NB_DAILY=7 # nb de sauvegardes quotidiennes a conserver +NB_WEEKLY=4 # nombre de sauvegardes hebdomadaires a conserver +NB_MONTHLY=12 # nombre de sauvegardes mensuelles a conserver # Work in backup directory: cd $storage diff --git a/tools/etc/scodoc-backup-db.service b/tools/etc/scodoc-backup-db.service new file mode 100644 index 000000000..d17e7a1ad --- /dev/null +++ b/tools/etc/scodoc-backup-db.service @@ -0,0 +1,18 @@ +# +# Systemd service to backup ScoDoc postgresql database +# +# Put this file in /etc/systemd/system, along with scodoc-updater.timer +# and then run +# systemctl enable scodoc-updater.timer +# systemctl start scodoc-updater.timer +# +# E. Viennet jun 2019 +# + +[Unit] +Description=Update ScoDoc Software + +[Service] +Type=oneshot +ExecStart=/opt/scodoc/tools/backup_db9 SCODOC + diff --git a/tools/etc/scodoc-backup-db.timer b/tools/etc/scodoc-backup-db.timer new file mode 100644 index 000000000..68a22c383 --- /dev/null +++ b/tools/etc/scodoc-backup-db.timer @@ -0,0 +1,16 @@ +# +# Systemd service to upgrade ScoDoc +# +# Put this file in /etc/systemd/system, along with scodoc-updater.service +# +# E. Viennet oct 2023 +# + +[Unit] +Description=Dump ScoDoc database each hour (*:07) + +[Timer] +OnCalendar=*-*-* *:07:00 + +[Install] +WantedBy=timers.target