cronjob to sync syncthing wordpress to glusterfs

This commit is contained in:
2024-01-24 15:18:49 +00:00
parent 4befcfa206
commit 2f7a34db20

View File

@@ -0,0 +1,30 @@
job "wordpress-backup" {
datacenters = ["alo"]
type = "batch"
periodic {
cron = "*/5 * * * * *"
prohibit_overlap = true
}
group "cron" {
task "rsync" {
driver = "raw_exec"
config {
command = "/bin/sh"
args = [ "local/script.sh" ]
}
template {
destination = "local/script.sh"
data = <<EOH
set -e
/run/current-system/sw/bin/rsync -a /data/sync/wordpress /data/compute/appdata/wordpress/ && \
echo "last_success $(date +%s)" | \
/run/current-system/sw/bin/curl --data-binary @- http://pushgateway.service.consul:9091/metrics/job/wordpress_backup
EOH
}
}
}
}