#!/bin/bash # -*- Mode: shell-script -*- # Copyright (C) 2003 by MandrakeSoft, Chmouel Boudjnah <chmouel@mandrakesoft.com> # Redistribution of this file is permitted under the terms of the GNU # Public License (GPL) # # suspend: 20 # resume: 10 # resume-second: 50 # . /etc/sysconfig/suspend ARG=$1 function suspend { if [[ -z $SUSPEND_DISK || $SUSPEND_DISK == "no" ]];then exit; fi for i in /proc/ide/hd*; do DRIVE=/dev/`echo $i |sed -e "s,.*/,,g"` if test "x`cat $i/media`" = "xdisk"; then hdparm $SUSPEND_DISK $DRIVE fi done } function resume { if [[ -z $RESUME_DISK || $RESUME_DISK == "no" ]];then exit; fi for i in /proc/ide/hd*; do DRIVE=/dev/`echo $i |sed -e "s,.*/,,g"` if test "x`cat $i/media`" = "xdisk"; then hdparm -q -S0 $DRIVE fi done } function resume2 { if [[ -n $SUSPEND_RESUME ]];then for i in /proc/ide/hd*; do DRIVE=/dev/`echo $i |sed -e "s,.*/,,g"` if test "x`cat $i/media`" = "xdisk"; then hdparm $SUSPEND_RESUME $DRIVE fi done fi } case $ARG in suspend) suspend ;; resume2) resume2 ;; resume) resume ;; esac