From e80229df0bbc56910ae49874981ac7420b6816b6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Am=C3=A9lia=20Coutard-Sander?= Date: Mon, 25 Nov 2024 22:20:46 +0100 Subject: [PATCH] Basic daemon --- daemon.sh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100755 daemon.sh diff --git a/daemon.sh b/daemon.sh new file mode 100755 index 0000000..ac6e7d7 --- /dev/null +++ b/daemon.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash + +mktempfifo() { + name="$(mktemp -u)" + mkfifo "$name" || mktempfifo +} + +if test -z $1 || test -z $2 || ! test -z $3; then + echo >&2 "Usage: $0 " + exit 1 +fi + +service="$1" +passphrase="$2" + +echo >&2 "Running $service on port $passphrase-git-$service." + +mktempfifo +while < "$name" gnunet-cadet -o "$passphrase-git-$service" | git "$service" . > "$name"; test 130 != "$?"; do + rm "$name" + mktempfifo +done + +rm $name + +echo >&2 "Terminating $service on port $passphrase-$service." -- 2.46.0