cat <<EOF
Usage: relay-cmd poweroff|poweron|reboot HOSTNAME|CHANNEL [RELAY_ID]
-For CHANNEL and RELAY_ID, run hidusb-relay-cmd and hidusb-relay-cmd state.
-I recommend writing a config to use HOSTNAME instead. Config is /etc/relay-cmd.conf
-Example config:
-
-# This config is just bash that gets sourced.
+RELAY_ID is not needed if only 1 relay device is connected. To
+understand CHANNEL and RELAY_ID, run hidusb-relay-cmd and
+hidusb-relay-cmd state. I recommend writing a config in
+/etc/relay-cmd.conf , then using HOSTNAME instead of CHANNEL and
+RELAY_ID. It serves as documentation of what you connected the relay
+to. Example config:
+
+# This config is just sourced from bash, so make sure its valid bash.
# relay_id is not needed if only 1 relay is connected.
cephserver3_channel=1
cephserver3_relay_id=HURTM
+cephserver2_channel=2
+cephserver2_relay_id=HURTM
EOF
exit $1
}
source /etc/relay-cmd.conf
fi
+# we know HOSTNAME is given if it doesn't start with a number.
if [[ $chan != [0-9]* ]]; then
chan_var=${chan}_channel
chan=${!chan_var}