docs
authorIan Kelling <iank@fsf.org>
Mon, 4 Mar 2019 21:04:46 +0000 (16:04 -0500)
committerIan Kelling <iank@fsf.org>
Mon, 4 Mar 2019 21:04:46 +0000 (16:04 -0500)
libremanage

index a7dcaaa950b7090bd19a24f6174117936b4b28a6..6cf1898fbd1219e38cbc65bef87489b0aba608cd 100755 (executable)
@@ -14,15 +14,28 @@ usage() {
   cat <<EOF
 Usage: libremanage poweroff|poweron|reboot HOSTNAME|CHANNEL [BOARD_ID]
 
-BOARD_ID is not needed if only 1 relay device is connected.  To
-understand CHANNEL and BOARD_ID, run hidusb-relay-cmd and
-hidusb-relay-cmd state.
-
-Using a configuration (/etc/libremanage.conf) allows you to use HOSTNAME
-instead of CHANNEL and BOARD_ID.
+HOSTNAME is based on configuration in /etc/libremanage.conf.
 
 Note, the relay's channels default state when plugged in are off.
 
+Example config:
+
+# This config is sourced from bash, so make sure its valid bash.
+cephserver3_channel=1
+cephserver3_board_id=HURTM
+cephserver2_channel=2
+cephserver2_board_id=HURTM
+# end of config
+
+Example usage given the above config:
+
+libremanage reboot cephserver3
+
+BOARD_ID is not needed if only 1 relay device is connected, or if it is
+defined in the config. To understand CHANNEL and BOARD_ID, run
+hidusb-relay-cmd and hidusb-relay-cmd state.
+
+
 WARNING: Avoid ever manually running "hidusb-relay-cmd on" in
 production, because if you lose connectivity and can't turn it off, its
 like the server's power button is stuck being pushed in and it won't
@@ -33,19 +46,10 @@ it off. That is why this script runs locally and ignores signals when
 its running. If you run this script over ssh and lose connection as this
 script is running, it will continue to run and complete.
 
-Example config:
-
-# This config is sourced from bash, so make sure its valid bash.
-# board_id is not needed if only 1 relay device is connected.
-cephserver3_channel=1
-cephserver3_board_id=HURTM
-cephserver2_channel=2
-cephserver2_board_id=HURTM
-
 EOF
   if [[ -e /etc/libremanage.conf ]]; then
     echo "Current config:"
-    cat /etc/libremanage.conf
+    cat /etc/libremanage.conf
   else
     echo "Note: /etc/libremanage.conf does not exist on the current machine"
   fi
@@ -63,8 +67,8 @@ if [[ -e /etc/libremanage.conf ]]; then
   source /etc/libremanage.conf
 fi
 
-# Use config vars. We know the arg is a HOSTNAME if it doesn't start
-# with a number.
+# Use config vars when appropriate. We know the arg is a HOSTNAME if it
+# doesn't start with a number.
 if [[ $chan != [0-9]* ]]; then
   if [[ ! $board_id ]]; then
     board_id_var=${chan}_board_id