Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-07-18 10:59:26 +0200
committerErich Eckner <git@eckner.net>2018-07-18 10:59:26 +0200
commit4b440f5df1349a94d91505f162db0bae9c9c22ab (patch)
treebddfee994564f38f92292767d25384e7c5cf8271 /bin
parentd1f7ea1d254a4edcca52587b8745d3f3fd439218 (diff)
bin/ii-* splitted in several scripts to make it systemd-friendly
Diffstat (limited to 'bin')
-rwxr-xr-xbin/ii-connect35
-rwxr-xr-xbin/ii-watch27
2 files changed, 27 insertions, 35 deletions
diff --git a/bin/ii-connect b/bin/ii-connect
index a8df95b..8d807a9 100755
--- a/bin/ii-connect
+++ b/bin/ii-connect
@@ -7,13 +7,6 @@
# shellcheck source=../lib/load-configuration
. "${0%/*}/../lib/load-configuration"
-# start ii if it is not running
-if ! pgrep -x ii > /dev/null; then
- rm -rf --one-file-system "${irc_dir}"
- screen -S ii -d -m ii -s irc.freenode.net -f buildmaster -n buildmaster
- sleep 10
-fi
-
# register if not yet done
if tail -n1 "${irc_dir}/nickserv/out" 2> /dev/null | \
grep -qF 'This nickname is registered. Please choose a different nickname'; then
@@ -31,31 +24,3 @@ if ! grep ' archlinux32/bot/buildmaster .* buildmaster$' "${irc_dir}/out" | \
} | \
sponge "${irc_dir}/in"
fi
-
-# start watch daemon if not running yet
-if ! pgrep -f '/ii-connect watch$' > /dev/null; then
- screen -S ii-connect.watch -d -m "${base_dir}/bin/ii-connect" watch
-fi
-
-checksum=$(calculate_script_checksum)
-
-# watch if asked to
-if [ "$1" = 'watch' ]; then
- 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
- exit
-fi
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