aboutsummaryrefslogtreecommitdiffstats
path: root/listener.sh
diff options
context:
space:
mode:
Diffstat (limited to 'listener.sh')
-rwxr-xr-xlistener.sh11
1 files changed, 11 insertions, 0 deletions
diff --git a/listener.sh b/listener.sh
new file mode 100755
index 00000000..1d68bb4a
--- /dev/null
+++ b/listener.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+# Check if the socket file exists
+if [ -S /sockets/ctrl ]; then
+ echo "Socket exists. Unlinking..."
+ rm /sockets/ctrl
+fi
+
+# Start socat
+socat UNIX-LISTEN:/sockets/ctrl,reuseaddr,fork SYSTEM:'sh -c "cat | while read line; do output=\$(eval \$line 2>&1); echo \$output; done"'
+