Commit 1a7d5992 authored by cjmueller's avatar cjmueller

* Make hd-idle's build environment compatible to Debian package management;

   this effort is meant to allow hd-idle to become an official Debian package
 * Man page for hd-idle
parent 388462c3
Version 1.03
------------
Bugs
- Use %u in dprintf() when reporting number of reads and writes (the
corresponding variable is an unsigned int).
- Fix example in README where the parameter "-a" was written as "-n".
Version 1.02
------------
Features
- In case the SCSI stop unit command fails with "check condition", print a
hex dump of the sense buffer to stderr. This is supposed to help
debugging.
Version 1.01
------------
Features
- The parameter "-a" now also supports symlinks for disk names. Thus, disks
can be specified using something like /dev/disk/by-uuid/... Use "-d" to
verify that the resulting disk name is what you want.
Please note that disk names are resolved to device nodes at startup. Also,
since many entries in /dev/disk/by-xxx are actually partitions, partition
numbers are automatically removed from the resulting device node.
Bugs
- Not really a bug, but the disk name comparison used strstr which is a bit
useless because only disks starting with "sd" and a single letter after
that are currently considered. Replaced the comparison with strcmp()
Version 1.00
------------
Features
- New parameter "-a" to allow selecting idle timeouts for individual disks;
compatibility to previous releases is maintained by having an implicit
default which matches all SCSI disks
Bugs
- Changed comparison operator for idle periods from '>' to '>=' to prevent
adding one polling interval to idle time
- Changed sleep time before calling sync after updating the log file to 1s
(from 3s) to accumulate fewer dirty blocks before synching. It's still
a compromize but the log file is for debugging purposes, anyway. A test
with fsync() was unsuccessful because the next bdflush-initiated sync
still caused spin-ups.
Version 0.99
------------
Features
- Initial version of hd-idle.
Please refer to debian/changelog
......@@ -4,17 +4,22 @@
#
###############################################################################
TARGET_DIR = /usr/local/sbin
SCRIPT_DIR = /etc
ifdef DESTDIR
# dh_auto_install (Debian) sets this variable
TARGET_DIR = $(DESTDIR)/usr
else
TARGET_DIR ?= /usr/local
endif
LIB_DIRS =
INC_DIRS =
CC_DEBUG = -g
CFLAGS = $(CC_DEBUG) $(INC_DIRS) -Wall
CC = gcc
CC ?= gcc
CFLAGS += $(INC_DIRS) -Wall
LD = $(CC)
LDFLAGS += $(LIB_DIRS)
###############################################################################
#
......@@ -32,23 +37,18 @@ OBJS = $(SRCS:.c=.o)
all: $(TARGET)
distclean: clean
clean:
rm -f $(OBJS) $(TARGET)
install: $(TARGET)
install -g root -o root $(TARGET) $(TARGET_DIR)
install-debian:
install -g root -o root $(TARGET) /usr/sbin
install -g root -o root scripts/debian/init.d/hd-idle /etc/init.d
install -g root -o root scripts/debian/default/hd-idle /etc/default
@echo
@echo Please run \"update-rc.d hd-idle defaults\" to start hd-idle automatically
@echo and check /etc/default/hd-idle for configuration information
install -D -g root -o root $(TARGET) $(TARGET_DIR)/sbin/$(TARGET)
install -D -g root -o root $(TARGET).1 $(TARGET_DIR)/share/man/man1/$(TARGET).1
hd-idle.o: hd-idle.c
$(TARGET): $(OBJS)
$(LD) $(CC_DEBUG) -o $(TARGET) $(OBJS) $(LIB_DIRS) $(LIBS)
$(LD) $(LDFLAGS) -o $(TARGET) $(OBJS) $(LIB_DIRS) $(LIBS)
......@@ -43,16 +43,24 @@ script at this point, just a makefile for Linux. Since hd-idle is using the
Linux generic SCSI layer, it requires the include files scsi/sg.h and
scsi/scsi.h which should come with libc6-dev (at least on Debian they do).
* In order to compile the program, type "make".
Non-Debian Systems:
* In order to compile the program, type "make".
* In order to install the program into /usr/local/sbin, type "make install"
(this will also install the manpage into /usr/local/share/man/man1)
* In order to install the program into /usr/local/sbin, type "make install"
Debian Systems:
* Run "dpkg-buildpackage -rfakeroot"
* Run "dpkg -i ../hd-idle_*.deb" to install the package
* In order to install the program on a Debian system into /usr/sbin,
including scripts to automatically start hd-idle at system boot time,
type "make install-debian". Once completed, please run
"update-rc.d hd-idle defaults" and check /etc/default/hd-idle for
configuration information. The default settings will *not* start
hd-idle automatically.
NOTE: The build framework has been changed to be compatible to the Debian
package management with the intention of making hd-idle an official
Debian package. Once this effort has completed, hd-idle can be
installed with "apt-get install hd-idle". The changes to the Debian
build instructions as outlined above (previous releases used "make
install_debian") are a side effect of this effort.
Once completed, please check /etc/default/hd-idle for configuration
information. The default settings will *not* start hd-idle automatically.
Running hd-idle
---------------
......@@ -70,6 +78,7 @@ this file is not present, hd-idle won't work.
In case of problems, use the debug option (-d) tp get further information.
Command line options:
-a <name> Set device name of disks for subsequent idle-time
parameters (-i). This parameter is optional in the
sense that there's a default entry for all disks
......
hd-idle (1.04) unstable; urgency=low
* Make hd-idle's build environment compatible to Debian package management;
this effort is meant to allow hd-idle to become an official Debian package
* Man page for hd-idle
-- Christian Mueller <cm1@mumac.de> Fri, 30 Sep 2011 22:35:12 +0200
hd-idle (1.03) unstable; urgency=low
* Use %u in dprintf() when reporting number of reads and writes (the
corresponding variable is an unsigned int).
* Fix example in README where the parameter "-a" was written as "-n".
-- Christian Mueller <cm1@mumac.de> Sun, 5 Dec 2010 19:25:51 +0100
hd-idle (1.02) unstable; urgency=low
* In case the SCSI stop unit command fails with "check condition", print a
hex dump of the sense buffer to stderr. This is supposed to help
debugging.
-- Christian Mueller <cm1@mumac.de> Sat, 6 Nov 2010 15:47:00 +0100
hd-idle (1.01) unstable; urgency=low
* The parameter "-a" now also supports symlinks for disk names. Thus, disks
can be specified using something like /dev/disk/by-uuid/... Use "-d" to
verify that the resulting disk name is what you want.
Please note that disk names are resolved to device nodes at startup. Also,
since many entries in /dev/disk/by-xxx are actually partitions, partition
numbers are automatically removed from the resulting device node.
* Not really a bug, but the disk name comparison used strstr which is a bit
useless because only disks starting with "sd" and a single letter after
that are currently considered. Replaced the comparison with strcmp()
-- Christian Mueller <cm1@mumac.de> Fri, 26 Feb 2010 14:03:44 +0100
hd-idle (1.00) unstable; urgency=low
* New parameter "-a" to allow selecting idle timeouts for individual disks;
compatibility to previous releases is maintained by having an implicit
default which matches all SCSI disks
* Changed comparison operator for idle periods from '>' to '>=' to prevent
adding one polling interval to idle time
* Changed sleep time before calling sync after updating the log file to 1s
(from 3s) to accumulate fewer dirty blocks before synching. It's still
a compromize but the log file is for debugging purposes, anyway. A test
with fsync() was unsuccessful because the next bdflush-initiated sync
still caused spin-ups.
-- Christian Mueller <cm1@mumac.de> Wed, 18 Nov 2009 20:53:17 +0100
hd-idle (0.99) unstable; urgency=low
* Initial Release.
-- Christian Mueller <cm1@mumac.de> Mon, 23 Apr 2007 22:03:10 +0100
Source: hd-idle
Section: utils
Priority: extra
Maintainer: Christian Mueller <cm1@mumac.de>
Build-Depends: debhelper (>= 7.0.50~), libc6-dev
Standards-Version: 3.8.4
Homepage: http://hd-idle.sf.net
#Vcs-Git: git://git.debian.org/collab-maint/hd-idle.git
#Vcs-Browser: http://git.debian.org/?p=collab-maint/hd-idle.git;a=summary
Package: hd-idle
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: Spin down idle [USB] hard disks
hd-idle is a utility program for spinning-down external disks after a period
of idle time. Since most external IDE disk enclosures don't support setting
the IDE idle timer, a program like hd-idle is required to spin down idle disks
automatically.
.
A word of caution: hard disks don't like spinning up too often. Laptop disks
are more robust in this respect than desktop disks but if you set your disks
to spin down after a few seconds you may damage the disk over time due to the
stress the spin-up causes on the spindle motor and bearings. It seems that
manufacturers recommend a minimum idle time of 3-5 minutes, the default in
hd-idle is 10 minutes.
.
One more word of caution: hd-idle will spin down any disk accessible via the
SCSI layer (USB, IEEE1394, ...) but it will not work with real SCSI disks
because they don't spin up automatically. Thus it's not called scsi-idle and
I don't recommend using it on a real SCSI system unless you have a kernel
patch that automatically starts the SCSI disks after receiving a sense buffer
indicating the disk has been stopped. Without such a patch, real SCSI disks
won't start again and you can as well pull the plug.
This work was written and packaged by Christian Mueller <cm1@mumac.de>
It was downloaded from: <http://hd-idle.sf.net>
Upstream Author(s): Christian Mueller <cm1@mumac.de>
Copyright:
<Copyright (C) 2007 Christian Mueller>
License:
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This package is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
On Debian systems, the complete text of the GNU General
Public License version 3 can be found in "/usr/share/common-licenses/GPL-3".
The Debian packaging is:
Copyright (C) 2011 Christian Mueller <cm1@mumac.de>
and is licensed under the GPL version 3, see above.
# defaults file for hd-idle
# start hd-idle automatically?
START_HD_IDLE=false
# hd-idle command line options
# Options are:
# -a <name> Set device name of disks for subsequent idle-time
# parameters (-i). This parameter is optional in the
# sense that there's a default entry for all disks
# which are not named otherwise by using this
# parameter. This can also be a symlink
# (e.g. /dev/disk/by-uuid/...)
# -i <idle_time> Idle time in seconds.
# -l <logfile> Name of logfile (written only after a disk has spun
# up). Please note that this option might cause the
# disk which holds the logfile to spin up just because
# another disk had some activity. This option should
# not be used on systems with more than one disk
# except for tuning purposes. On single-disk systems,
# this option should not cause any additional spinups.
#
# Options not exactly useful here:
# -t <disk> Spin-down the specfified disk immediately and exit.
# -d Debug mode. This will prevent hd-idle from
# becoming a daemon and print debugging info to
# stdout/stderr
# -h Print usage information.
#HD_IDLE_OPTS="-i 180 -l /var/log/hd-idle.log"
#!/bin/sh
### BEGIN INIT INFO
# Provides: hd-idle
# Required-Start: $local_fs
# Required-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: start hd-idle daemon (spin down idle hard disks)
### END INIT INFO
PATH=/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/hd-idle
HD_IDLE_OPTS="-i 600"
START_HD_IDLE=false
[ -r /etc/default/hd-idle ] && . /etc/default/hd-idle
if [ "$START_HD_IDLE" != "true" ] ; then
exit 0
fi
# See if the daemon is there
test -x $DAEMON || exit 0
. /lib/lsb/init-functions
case "$1" in
start)
log_daemon_msg "Starting the hd-idle daemon" "hd-idle"
start-stop-daemon --start --quiet --oknodo --exec $DAEMON -- $HD_IDLE_OPTS
log_end_msg $?
;;
stop)
log_daemon_msg "Stopping the hd-idle daemon" "hd-idle"
start-stop-daemon --stop --quiet --oknodo --exec $DAEMON
log_end_msg $?
;;
restart|force-reload)
$0 stop && sleep 2 && $0 start
;;
*)
echo "Usage: /etc/init.d/hd-idle start/stop/restart/force-reload"
exit 1
;;
esac
#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.
# Uncomment this to turn on verbose mode.
# export DH_VERBOSE=1
%:
dh $@
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment