From 9ebad060dcdf795fe26c1e28af460def5b79e4da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C8=98tefan=20Talpalaru?= Date: Sun, 28 Jun 2020 20:16:01 +0200 Subject: [PATCH] add cron job --- defaults/main.yml | 4 ++++ tasks/cron.yml | 11 +++++++++++ tasks/main.yml | 1 + 3 files changed, 16 insertions(+) create mode 100644 tasks/cron.yml diff --git a/defaults/main.yml b/defaults/main.yml index 58dd299..6130125 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -31,3 +31,7 @@ beacon_node_restart_window_sec: 120 # general container management compose_recreate: false + +# shared testnet cron job +beacon_node_shared_testnet_cron: false + diff --git a/tasks/cron.yml b/tasks/cron.yml new file mode 100644 index 0000000..d2d188d --- /dev/null +++ b/tasks/cron.yml @@ -0,0 +1,11 @@ +--- +# "cron.name" should not be changed, or a new cron job will be created for the new name, +# in addition to the old one. +- name: "Shared testnet: periodic container restart Cron job" + cron: + name: "shared testnet restart" + minute: "10" + hour: "0,6,12,18" + job: "PATH='/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin'; cd {{ beacon_node_cont_vol }}; docker-compose --compatibility run --rm --name {{ beacon_node_cont_name }}-build-run beacon_node --build; docker-compose restart -t 60" + when: beacon_node_shared_testnet_cron + diff --git a/tasks/main.yml b/tasks/main.yml index 856d689..335a2f1 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -2,5 +2,6 @@ - import_tasks: install.yml - import_tasks: compose.yml - import_tasks: container.yml +- import_tasks: cron.yml - import_tasks: firewall.yml - import_tasks: consul.yml