usage() {
cat <<EOF
-Usage: libremanage poweroff|poweron|reboot HOSTNAME|CHANNEL [BOARD_ID]
+Basic Usage: libremanage poweroff|poweron|reboot HOSTNAME
-HOSTNAME is based on configuration in /etc/libremanage.conf.
+Available HOSTNAMEs defined in /etc/libremanage.conf on this machine:
+
+EOF
+
+ if [[ -e /etc/libremanage.conf ]]; then
+ sed -r '/\s*#/d;/^\s*$/d;s/_.*//' /etc/libremanage.conf
+ else
+ echo "/etc/libremanage.conf does not exist."
+ fi
+
+ cat <<EOF
+
+Thats all you need to know unless you are defining configuration or
+setting up a device.
+
+Advanced Usage: libremanage poweroff|poweron|reboot HOSTNAME|CHANNEL [BOARD_ID]
Note, the relay's channels default state when plugged in are off.
-Example config:
+Example /etc/libremanage.conf:
# This config is sourced from bash, so make sure its valid bash.
cephserver3_channel=1
cephserver2_board_id=HURTM
# end of config
-Example usage given the above config:
libremanage reboot cephserver3
EOF
if [[ -e /etc/libremanage.conf ]]; then
- echo "Current config:"
+ echo "Current /etc/libremanage.conf:"
cat /etc/libremanage.conf
else
echo "Note: /etc/libremanage.conf does not exist on the current machine"