Browse Source

example files/scripts for apply-state

boyska 2 years ago
parent
commit
24fcc4dba8
3 changed files with 24 additions and 0 deletions
  1. 3 0
      ring_mon/example-state.json
  2. 3 0
      ring_mon/get-status
  3. 18 0
      ring_mon/set-light

+ 3 - 0
ring_mon/example-state.json

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

+ 3 - 0
ring_mon/get-status

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

+ 18 - 0
ring_mon/set-light

@@ -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
+