xref: /aosp_15_r20/external/sg3_utils/scripts/scsi_temperature (revision 44704f698541f6367e81f991ef8bb54ccbf3fc18)
1#!/bin/bash
2
3###################################################################
4#
5#  Check the temperature of the given SCSI device(s).
6#
7#  This script assumes the sg3_utils package is installed.
8#
9##################################################################
10
11verbose=""
12
13usage()
14{
15  echo "Usage: scsi_temperature [-h] [-v] <device>+"
16  echo "  where:"
17  echo "    -h, --help           print usage message"
18  echo "    -v, --verbose        more verbose output"
19  echo ""
20  echo "Use SCSI LOG SENSE command to fetch temperature of each <device>"
21}
22
23opt="$1"
24while test ! -z "$opt" -a -z "${opt##-*}"; do
25  opt=${opt#-}
26  case "$opt" in
27    h|-help) usage ; exit 0 ;;
28    v|-verbose) verbose="-v" ;;
29    vv) verbose="-vv" ;;
30    *) echo "Unknown option: -$opt " ; exit 1 ;;
31  esac
32  shift
33  opt="$1"
34done
35
36if [ $# -lt 1 ]
37  then
38    usage
39    exit 1
40fi
41
42for i
43do
44	echo "sg_logs -t $verbose $i"
45        sg_logs -t $verbose $i
46done
47