Introduction
Introduction Statistics Contact Development Disclaimer Help
Refactor service startup, make it modular. - annna - Annna the nice friendly bo…
git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws6…
Log
Files
Refs
Tags
README
---
commit a9faa5e4eaee28562ff2de88d5f073fcaaaed503
parent 3c8d08bf47e5486d78b3c1cf443df70a9c7ee57a
Author: Annna Robert-Houdin <[email protected]>
Date: Mon, 20 Dec 2021 00:05:22 +0100
Refactor service startup, make it modular.
Diffstat:
M annna-channel-service | 2 +-
M annna-start-main | 7 +++----
A annna-start-service | 35 +++++++++++++++++++++++++++++…
D annna-start-services | 37 -----------------------------…
4 files changed, 39 insertions(+), 42 deletions(-)
---
diff --git a/annna-channel-service b/annna-channel-service
@@ -14,7 +14,7 @@ channel="$2"
iiroot="/home/annna/irc"
iibase="/home/annna/irc/${server}"
-ls "${iibase}/${channel}/out" | entr tail -n 1 "${iibase}/${channel}/out" \
+ls "${iibase}/${channel}/out" | entr tail -n 1 "${iibase}/${channel}/out" 2>/d…
| sed -nu 's,[0-9]* <\([^ >]*\)> \(.*\),\1 \2,p' \
| {
while read -r user text;
diff --git a/annna-start-main b/annna-start-main
@@ -45,7 +45,7 @@ iipid=$!
# services disappear.
while kill -0 $iipid >/dev/null 2>&1;
do
- sleep 1
+ sleep 10
done
rm -rf $HOME/irc/${server}
@@ -91,8 +91,7 @@ do
do
sleep 0.5
done
-done
-# Services
-annna-start-services
+ annna-start-service "${server}" "${chan}"
+done
diff --git a/annna-start-service b/annna-start-service
@@ -0,0 +1,35 @@
+#!/bin/sh
+#
+# Here follow scriplets to listen for commands in annna.
+#
+
+if [ $# -lt 2 ];
+then
+ printf "usage: %s server channel\n" "$(basename "$0")"
+ exit 1
+fi
+server="$1"
+channel="$2"
+
+export PATH="$PATH:/home/annna/bin"
+# plan9port
+export PATH="$PATH:/opt/plan9/bin"
+
+iiroot="/home/annna/irc"
+iibase="/home/annna/irc/${server}"
+
+# Permissions
+[ -d ${iiroot} ] && chmod o+rx ${iiroot}
+[ -d ${iibase} ] && chmod o+rx ${iibase}
+
+## Channel handlers
+[ -d "${iibase}/${channel}" ] \
+ && chmod o+rx "${iibase}/${channel}"
+[ -p "${iibase}/${channel}/in" ] \
+ && chmod o+w "${iibase}/${channel}/in"
+
+if [ -f "${iibase}/${channel}/out" ];
+then
+ annna-channel-service "${server}" "${channel}" &
+fi
+
diff --git a/annna-start-services b/annna-start-services
@@ -1,37 +0,0 @@
-#!/bin/sh
-#
-# Here follow scriplets to listen for commands in annna.
-#
-
-export PATH="$PATH:/home/annna/bin"
-
-# plan9port
-export PATH="$PATH:/opt/plan9/bin"
-
-server="irc.bitreich.org"
-iiroot="/home/annna/irc"
-iibase="/home/annna/irc/${server}"
-channel_list="#bitreich #bitreich-en #bitreich-fr #bitreich-de #bitreich-nl #b…
-
-#testing
-#channel_list="#bitreich-scm"
-
-# Permissions
-[ -d ${iiroot} ] && chmod o+rx ${iiroot}
-[ -d ${iibase} ] && chmod o+rx ${iibase}
-
-## Channel handlers
-for channel in $channel_list;
-do
- # Permissions
- [ -d "${iibase}/${channel}" ] \
- && chmod o+rx "${iibase}/${channel}"
- [ -p "${iibase}/${channel}/in" ] \
- && chmod o+w "${iibase}/${channel}/in"
-
- if [ -f "${iibase}/${channel}/out" ];
- then
- annna-channel-service "${server}" "${channel}" &
- fi
-done
-
You are viewing proxied material from bitreich.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.