~ubuntu-branches/debian/sid/sg3-utils/sid

« back to all changes in this revision

Viewing changes to scripts/scsi_start

  • Committer: Bazaar Package Importer
  • Author(s): Michael Biebl
  • Date: 2009-11-05 20:42:13 UTC
  • mfrom: (5.2.2 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091105204213-ug7wrb6m7l9kmvyg
* QA upload.
* Add libsgutils2-2.symbols.kfreebsd. Some of the symbols are Linux
  specific causing FTBFS on kfreebsd.

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
#  Spin up the given SCSI disk(s).
6
6
#
7
7
#  SCSI disks (or disks that understand SCSI commands)
8
 
#  are assumed. The immediate bit is set so the command
9
 
#  should return immediately. The disk however will take
10
 
#  10 seconds or more to spin up.
 
8
#  are assumed. By default, the immediate bit is set so the
 
9
#  command should return immediately. The disk however will
 
10
#  take 10 seconds or more to spin up. The '-w' option
 
11
#  causes each start to wait until the disk reports that it
 
12
#  has started.
11
13
#
12
14
#  This script assumes the sg3_utils package is installed.
13
15
#
14
16
###############################################
15
17
 
16
18
verbose=""
 
19
immediate="-i"
17
20
 
18
21
usage()
19
22
{
20
 
  echo "Usage: scsi_start [-h] [-v] <device>+"
 
23
  echo "Usage: scsi_start [-h] [-v] [-w] <device>+"
21
24
  echo "  where:"
22
25
  echo "    -h, --help           print usage message"
23
26
  echo "    -v, --verbose        more verbose output"
 
27
  echo "    -w, --wait           wait for each start to complete"
24
28
  echo ""
25
29
  echo "Send SCSI START STOP UNIT command to start each <device>"
26
30
}
37
41
  case "$opt" in
38
42
    h|-help) usage ; exit 0 ;;
39
43
    v|-verbose) verbose="-v" ;;
 
44
    w|-wait) immediate="" ;;
40
45
    *) echo "Unknown option: -$opt " ; exit 1 ;;
41
46
  esac
42
47
  shift
45
50
 
46
51
for i
47
52
do
48
 
        echo "sg_start -i 1 $verbose $i"
49
 
        sg_start -i 1 $verbose $i
 
53
        echo "sg_start $immediate 1 $verbose $i"
 
54
        sg_start $immediate 1 $verbose $i
50
55
done