diff options
author | Erich Eckner <git@eckner.net> | 2018-07-18 10:59:26 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2018-07-18 10:59:26 +0200 |
commit | 4b440f5df1349a94d91505f162db0bae9c9c22ab (patch) | |
tree | bddfee994564f38f92292767d25384e7c5cf8271 /bin/ii-watch | |
parent | d1f7ea1d254a4edcca52587b8745d3f3fd439218 (diff) | |
download | builder-4b440f5df1349a94d91505f162db0bae9c9c22ab.tar.xz |
bin/ii-* splitted in several scripts to make it systemd-friendly
Diffstat (limited to 'bin/ii-watch')
-rwxr-xr-x | bin/ii-watch | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/bin/ii-watch b/bin/ii-watch new file mode 100755 index 0000000..0987656 --- /dev/null +++ b/bin/ii-watch @@ -0,0 +1,27 @@ +#!/bin/sh + +# shellcheck disable=SC2119,SC2120 + +# shellcheck source=../lib/load-configuration +. "${0%/*}/../lib/load-configuration" + +checksum=$( + calculate_script_checksum +) + +while pgrep -x 'ii' >/dev/null && \ + [ "$(calculate_script_checksum)" = "${checksum}" ]; do + # this avoids missing modifications during our last execution + if [ -z "${said}" ]; then + # shellcheck disable=SC2046 + inotifywait -t 30 -e 'CLOSE_WRITE,CLOSE' -e 'CREATE,ISDIR' $( + find "${irc_dir}" \ + -type f \ + -name 'out' -o \ + -type d + ) || true + fi + said=$( + "${base_dir}/bin/ii-answer" + ) +done |