diff options
author | Erich Eckner <git@eckner.net> | 2021-03-18 13:59:36 +0100 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2021-03-18 13:59:36 +0100 |
commit | e6a780e83a2df5284efca4a5f740c1445f1becf1 (patch) | |
tree | f710169b6e61adb324d431f4a1a901eed1b5068e | |
parent | a10c10a9cd1d620ae003b66be6be2aac4bed3e85 (diff) | |
download | builder-e6a780e83a2df5284efca4a5f740c1445f1becf1.tar.xz |
bin/ii-watch: keep an eye on lingering intentions
-rwxr-xr-x | bin/ii-watch | 23 | ||||
-rwxr-xr-x | lib/load-configuration | 4 |
2 files changed, 23 insertions, 4 deletions
diff --git a/bin/ii-watch b/bin/ii-watch index e72bf6a..03088ff 100755 --- a/bin/ii-watch +++ b/bin/ii-watch @@ -10,6 +10,7 @@ checksum=$( ) next_connection_check=0 +next_intentions_check=0 last_seen=0 while pgrep -x 'ii' >/dev/null && \ @@ -37,6 +38,28 @@ while pgrep -x 'ii' >/dev/null && \ said=$( "${base_dir}/bin/ii-answer" ) + if [ ${next_intentions_check} -lt $(date +%s) ]; then + # Are there old intentions waiting for execution? + oldest_intention=$( + find "${intentions_directory}" \ + -maxdepth 1 \ + -type f \ + -name 'intention.*' \ + -mmin +1200 \ + -printf '%Ts\n' \ + | sort -n \ + | tail -n1 + ) + if [ -n "${oldest_intention}" ]; then + printf 'There is something intented for %s minutes.\n' $(( + $(date +%s) - oldest_intention + )) \ + | irc_say + next_intentions_check=$(( + $(date +%s) + 3600 + )) + fi + fi # When was the buildmaster seen the last time? last_seen=$( { diff --git a/lib/load-configuration b/lib/load-configuration index b12b0cd..eb9ad1e 100755 --- a/lib/load-configuration +++ b/lib/load-configuration @@ -4,10 +4,6 @@ # shellcheck disable=SC2034 -# TODO: If there are intentions left which noone executes, we should try -# to reexecute them or at least warn the caller. Else, we might wait -# indefinitely. - set -e export LANG=C |