Преглед на файлове

chore: add cron and systemd examples

Emmanuel Bouthenot преди 7 месеца
родител
ревизия
0cf5254eba
променени са 3 файла, в които са добавени 35 реда и са изтрити 0 реда
  1. 15 0
      services/cron/autopostgresqlbackup
  2. 11 0
      services/systemd/autopostgresqlbackup.service
  3. 9 0
      services/systemd/autopostgresqlbackup.timer

+ 15 - 0
services/cron/autopostgresqlbackup

@@ -0,0 +1,15 @@
+#!/bin/sh
+#
+# autopostgresqlbackup daily cron task
+#
+
+if [ -d /run/systemd/system ]; then
+    # Skip in favour of systemd timer.
+    exit 0
+fi
+
+if [ -x /usr/sbin/autopostgresqlbackup ]; then
+	/usr/sbin/autopostgresqlbackup
+fi
+
+exit 0

+ 11 - 0
services/systemd/autopostgresqlbackup.service

@@ -0,0 +1,11 @@
+[Unit]
+Description=autopostgresqlbackup daily service
+Documentation=man:autopostgresqlbackup(8)
+After=postgresql.target mysql.target
+
+[Service]
+Type=oneshot
+ExecStart=/usr/sbin/autopostgresqlbackup
+ProtectHome=true
+ProtectSystem=full
+PrivateTmp=true

+ 9 - 0
services/systemd/autopostgresqlbackup.timer

@@ -0,0 +1,9 @@
+[Unit]
+Description=autopostgresqlbackup daily timer
+
+[Timer]
+OnCalendar=daily
+Persistent=true
+
+[Install]
+WantedBy=timers.target