summaryrefslogtreecommitdiff
path: root/bin/ii-watch
diff options
context:
space:
mode:
Diffstat (limited to 'bin/ii-watch')
-rwxr-xr-xbin/ii-watch27
1 files changed, 25 insertions, 2 deletions
diff --git a/bin/ii-watch b/bin/ii-watch
index e72bf6a..ae008c4 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 && \
@@ -22,7 +23,7 @@ while pgrep -x 'ii' >/dev/null && \
$(date +%s) + 60*5
))
fi
- echo '/NAMES #archlinux32' \
+ echo '/NAMES #archlinux32-devops' \
| sponge "${irc_dir}/in"
fi
if [ -z "${said}" ]; then
@@ -37,12 +38,34 @@ 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=$(
{
echo 0
sed '
- s/^\([0-9]\+\) = #archlinux32\( \S\+\)* buildmaster\( \S\+\)*$/\1/
+ s/^\([0-9]\+\) = #archlinux32-devops\( \S\+\)* buildmaster\( \S\+\)*$/\1/
t
d
' "${irc_dir}/out"