cronjob to sync syncthing wordpress to glusterfs
This commit is contained in:
30
services/wordpress-backup.hcl
Normal file
30
services/wordpress-backup.hcl
Normal 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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user