Skip to content

Instantly share code, notes, and snippets.

@stefanthoss
Last active April 25, 2020 04:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stefanthoss/ea4cd612c0050e5e4bc18bc063b3ddc9 to your computer and use it in GitHub Desktop.
Save stefanthoss/ea4cd612c0050e5e4bc18bc063b3ddc9 to your computer and use it in GitHub Desktop.
This script checks the standby status of disks in a FreeBSD system (e.g. FreeNAS). It can be used to check whether disks are spinning down properly. For each SATA and IDE hard drive, it will return either standby (0x00) or active/idle (0xff). The script needs to be run as root.
#!/usr/bin/env bash
DEVICES=$(camcontrol devlist | awk -F '[,)]' '{print $2}' | awk '/ad/{print}')
for DEV in $DEVICES; do
    printf "%s: " "$DEV"
    camcontrol epc "$DEV" -c status -P
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment