example files/scripts for apply-state

This commit is contained in:
boyska 2022-03-04 02:35:29 +01:00
parent 5ab34f1eb6
commit 24fcc4dba8
3 changed files with 24 additions and 0 deletions

View file

@ -0,0 +1,3 @@
{
"devices": {"1": "up", "2": "onair"}
}

3
ring_mon/get-status Executable file
View file

@ -0,0 +1,3 @@
#!/bin/sh
set -eu
jq -rM < example-state.json ".devices[\"$1\"]"

18
ring_mon/set-light Executable file
View file

@ -0,0 +1,18 @@
#!/bin/sh
set -eu
if [ "$DEVICE_NUMBER" = 0 ]; then
[ "$1" = on ] && exec numlockx on
[ "$1" = off ] && exec numlockx off
elif [ "$DEVICE_NUMBER" = 1 ]; then
[ "$1" = on ] && exec xset led named "Scroll Lock"
[ "$1" = off ] && exec xset -led named "Scroll Lock"
else
echo "Device number not supported" >&2
exit 2
fi
echo "Invalid usage" >&2
exit 2