From 7b2a5482bfe3138a3244bcb5a0b83346fb1fb5f1 Mon Sep 17 00:00:00 2001 From: Kevin Fenzi Date: Thu, 19 May 2016 19:05:16 +0000 Subject: [PATCH] Setup a cron job to update fulfiletimelist in alt. For now run every 6 hours, but once things settle down we can do more often. --- files/scripts/update-fullfiletimelist | 22 ++++++++++++++++++++++ playbooks/groups/secondary.yml | 8 ++++++++ 2 files changed, 30 insertions(+) create mode 100755 files/scripts/update-fullfiletimelist diff --git a/files/scripts/update-fullfiletimelist b/files/scripts/update-fullfiletimelist new file mode 100755 index 0000000000..26ea2f4f61 --- /dev/null +++ b/files/scripts/update-fullfiletimelist @@ -0,0 +1,22 @@ +#!/bin/bash + +# currently runs on secondary01 from cron to update alt + +MOD=$1 +[ -z "$MOD" ] && { + echo "usage: $0 " + exit 1 +} + +# This is the new list with timestamps + +TMPFILE=$(mktemp -p /tmp/) +pushd /srv/pub/$MOD > /dev/null +/usr/local/bin/create-filelist . > $TMPFILE +if diff $TMPFILE fullfiletimelist > /dev/null; then + rm -f $TMPFILE +else + mv $TMPFILE fullfiletimelist +fi +chmod 0644 fullfiletimelist +popd > /dev/null diff --git a/playbooks/groups/secondary.yml b/playbooks/groups/secondary.yml index 447f154ef9..f29aa1f406 100644 --- a/playbooks/groups/secondary.yml +++ b/playbooks/groups/secondary.yml @@ -62,5 +62,13 @@ - name: add create-filelist script from quick-fedora-mirror copy: src="{{ roles }}/bodhi2/backend/files/create-filelist" dest=/usr/local/bin/create-filelist mode=0755 + - name: add cron script to update fullfiletimelist + copy: src="{{ files }}/scripts/update-fullfiletimelist" dest=/usr/local/bin/update-fullfiletimelist mode=0755 + + - name: Update fullfiletimelist job + cron: name="update-fullfiletimelist" hour="*/6" minute="55" user="root" + job="/usr/local/bin/lock-wrapper update-fullfiletimelist '/usr/local/bin/update-fullfiletimelist alt'" + cron_file=update-fullfiletimelist + handlers: - include: "{{ handlers }}/restart_services.yml"