example files/scripts for apply-state
This commit is contained in:
parent
5ab34f1eb6
commit
24fcc4dba8
3 changed files with 24 additions and 0 deletions
3
ring_mon/example-state.json
Normal file
3
ring_mon/example-state.json
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"devices": {"1": "up", "2": "onair"}
|
||||||
|
}
|
3
ring_mon/get-status
Executable file
3
ring_mon/get-status
Executable file
|
@ -0,0 +1,3 @@
|
||||||
|
#!/bin/sh
|
||||||
|
set -eu
|
||||||
|
jq -rM < example-state.json ".devices[\"$1\"]"
|
18
ring_mon/set-light
Executable file
18
ring_mon/set-light
Executable 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
|
||||||
|
|
Loading…
Reference in a new issue