blob: 981e0b10db24712277834cad53199a1c26cd01ac (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
#!/bin/sh
if [ "$1" = "status" ]; then
shift
while [ $# -gt 0 ]; do
printf "%s" "bla, status, $1" | socat -T1 - udp-datagram:127.0.0.1:9915 | cut -c 5-
shift
done
elif [ "$1" = "exec" ]; then
name="$2"
shift 2
jq='{}'
while [ $# -gt 1 ]; do
jq=$( printf "%s" "$jq" | jq --arg key "${1#--}" --arg val "$2" '. += { ($key): $val }' )
shift 2
done
echo "Sending:"
echo "$jq"
printf "%s" "bla, $name, $jq" | socat -T1 - udp-datagram:127.0.0.1:9915 | cut -c 5-
else
echo "unknown command, try status or exec"
exit 1
fi
|