From f6246fb6a9f15102851afd3a97793f4b79004c0c Mon Sep 17 00:00:00 2001 From: Bruno Fontes Date: Mon, 10 Jun 2019 12:29:06 -0300 Subject: [PATCH] Including systemd services to backup VPS --- Services/backup-contabo-db.service | 5 +++++ Services/backup-contabo-db.timer | 10 ++++++++++ Services/backup-contabo-files.service | 5 +++++ Services/backup-contabo-files.timer | 10 ++++++++++ Services/logError.sh | 2 ++ Services/logErrors@.service | 6 ++++++ 6 files changed, 38 insertions(+) create mode 100644 Services/backup-contabo-db.service create mode 100644 Services/backup-contabo-db.timer create mode 100644 Services/backup-contabo-files.service create mode 100644 Services/backup-contabo-files.timer create mode 100755 Services/logError.sh create mode 100644 Services/logErrors@.service diff --git a/Services/backup-contabo-db.service b/Services/backup-contabo-db.service new file mode 100644 index 0000000..83f2e7d --- /dev/null +++ b/Services/backup-contabo-db.service @@ -0,0 +1,5 @@ +[Unit] +Description=Backup contabo db daily + +[Service] +ExecStart=/home/bruno/Backups/Contabo/backup-db.sh diff --git a/Services/backup-contabo-db.timer b/Services/backup-contabo-db.timer new file mode 100644 index 0000000..4f75156 --- /dev/null +++ b/Services/backup-contabo-db.timer @@ -0,0 +1,10 @@ +[Unit] +Description=Backup contabo db dayly + +[Timer] +#DayOfWeek Year-Month-Day Hour:Minute:Second +OnCalendar=*-*-* 10:00:00 +Persistent=true + +[Install] +WantedBy=timers.target diff --git a/Services/backup-contabo-files.service b/Services/backup-contabo-files.service new file mode 100644 index 0000000..01c813e --- /dev/null +++ b/Services/backup-contabo-files.service @@ -0,0 +1,5 @@ +[Unit] +Description=Backup contabo files once per week + +[Service] +ExecStart=/home/bruno/Backups/Contabo/backup-files.sh diff --git a/Services/backup-contabo-files.timer b/Services/backup-contabo-files.timer new file mode 100644 index 0000000..0e45f51 --- /dev/null +++ b/Services/backup-contabo-files.timer @@ -0,0 +1,10 @@ +[Unit] +Description=Backup contabo files once per week + +[Timer] +#DayOfWeek Year-Month-Day Hour:Minute:Second +OnCalendar=Mon *-*-* 11:00:00 +Persistent=true + +[Install] +WantedBy=timers.target diff --git a/Services/logError.sh b/Services/logError.sh new file mode 100755 index 0000000..5643ef5 --- /dev/null +++ b/Services/logError.sh @@ -0,0 +1,2 @@ +#!/bin/bash +sudo /bin/systemctl status --full "$1" >> /home/bruno/.log_error diff --git a/Services/logErrors@.service b/Services/logErrors@.service new file mode 100644 index 0000000..68a257a --- /dev/null +++ b/Services/logErrors@.service @@ -0,0 +1,6 @@ +[Unit] +Description=Log Systemd errors on my %i script on home + +[Service] +ExecStart=/home/bruno/Apps/linuxShortcuts/Services/logError.sh %i +#ExecStart=/bin/systemctl status --full %i >> /home/bruno/.log_error