aboutsummaryrefslogtreecommitdiffstats
path: root/listener.sh
blob: 1d68bb4a3ca4af4e5a0719d190c2d44b1ac40d9f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
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"'