My favorites | Sign in
Logo
                
Search
for
Updated May 27, 2008 by Dimitri.Michaux
Labels: Phase-Deploy, Featured
Usage  

Usage

Now you have your configuration file it is time to start the daemon:

# /etc/init.d/spindown start

If everything goes as planned there shouldn't be any errors and the deamon should start. The correct links for all the runlevels are already made so the deamon should start when you boot your computer. Spindown doesn't keep a log file because this would prevent a disk from properly spinning down, but it still is possible to get some status information from the deamon:

$ /etc/init.d/spindown status
name           watched        active         idle-time      spindown-time
sda            0              1              4              3600
sdb            1              0              22297          3600

You can also start the daemon yourself. If you would like to do this, please read the build in help function.

$ spindownd --help
Usage: spindownd [OPTION]...
spindownd is a daemon that spinsdown idle disks.

  -f, --fifo-path       The path to the fifo that is used for printing the
                          status. When the fifo doesn't exist it will be
                          created. The default is spindown.fifo in the
                          current directory.
  -c, --config-file     Path to the configuration file. The default is
                          spindown.conf in the current directory.
  -h, --help            Displays this text.
  -v, --version         Prints the version number.

For more information and contact visit <http://projects.dimis-site.be>.

Comment by barhorn, Sep 08, 2008

I got an error on my ClarkConnect? dist (which is RedHat? based) when starting the daemon (using version .2.2):

[root@nas ngb_root]# /etc/init.d/spindown start
Starting spindownd daemon... /etc/init.d/spindown: line 91: start-stop-daemon: command not found

I had to modify the /etc/init.d/spindown script to:

start() {

    echo -n "Starting spindownd daemon... "

    #start-stop-daemon --start \
    #        --exec ${SPINDOWNPATH} \
    #        --name spindownd \
    #        -- -f ${FIFOPATH} -c ${CONFPATH}

    #NGB Added
    daemon ${SPINDOWNPATH} -f ${FIFOPATH} -c ${CONFPATH}

    echo "done."

}

stop() {

    echo -n "Stopping spindownd daemon... "

    #start-stop-daemon --stop \
    #        --exec ${SPINDOWNPATH} \
    #        --name spindownd
    killproc ${SPINDOWNPATH}

    echo "done."
}

I hope this helps someone!

Comment by jorge.fabregas, Feb 22, 2009

Regarding the "start-stop-daemon: command not found" on Red Hat based systems... I would like to add, besides barhorn contribution, that you need to make sure you include the following line at the beginning of /etc/init.d/spindown:

source /etc/rc.d/init.d/functions

Otherwise, you'll get an error using "daemon".

HTH, Jorge

Comment by Dimitri.Michaux, Feb 22, 2009

Version 0.3.0 is just released it uses lsb functions, so I hope the init script will work on all distributions now. But I have only tested it on Debian.

Comment by FSalvert, Mar 30, 2009

Hi,

I just installed spindown from both the 1-click install for Opensuse and the tar file provided on that site and I get the following error messages that I do not know how to fix:

/etc/init.d/spindown: line 26: log_daemon_msg: command not found /etc/init.d/spindown: line 28: log_end_msg: command not found

If someone knows how to fix this please let me know since this daemon sounds interesting to save power.

Thanks

Francois

Comment by Dimitri.Michaux, Mar 31, 2009

Hello Francois,

I think you need to install the lsb (linux standard base) package for open suse for the init script to work.

Regards, Dimitri

Comment by FSalvert, Mar 31, 2009

Hi Dimitri,

I installed the lsb paclage and still get the error messages:

/etc/init.d/spindown: line 40: log_daemon_msg: command not found /etc/init.d/spindown: line 42: log_end_msg: command not found

Any other suggestions ? Thanks for your help.

Francois

Comment by Dimitri.Michaux, Mar 31, 2009

Did you check if the daemon is running? It could be that it is running but only complains about those function that are not found.

I found out that the error occurs when you have a to old version of lsb (are maybe I'm using a to recent version?) You could fix the problem by commenting out those lines (putting a # in front of them). They are only for displaying some status text and don't do anything important.

Comment by FSalvert, Apr 02, 2009

The daemon is not running even if the script is not returning any errors after commenting the lines. I have installed the latest version of lsb offered for opensuse.

Any other suggestion is welcomed.

Thanks Dimitri

Comment by Dimitri.Michaux, Apr 02, 2009

Try running spindown like this: spindownd -f /var/run/spindown.fifo -p /var/run/spindown.pid -c /etc/spindown.conf

This will start spindown without turning it into a daemon. Maybe this will give you some additional output.

Comment by Dimitri.Michaux, Apr 05, 2009

Francois,

If you still have trouble and interested, I have added code to the init script that creates all the lsb functions that are missing. They are not as good, but they will make it at least work on a system without those functions.

You can find the code in the svn and it will be available in the 0.3.1 release later this month.

Comment by FSalvert, Apr 06, 2009

Thanks I will try that !

Comment by muzicaic...@163.com, Apr 21, 2009

hello: I had a problem when I used it. I used marvell 6121 controller. And when I use "sg_start --stop /dev/sda" to stop it, sometimes the hard disk disappeared from my system . Then " fdisk -l" can't find the disk any more. Can you help me?

Comment by Dimitri.Michaux, Apr 23, 2009

@muzicaic...@163.com

Hi,

That's something I don't know how to fix. It looks like it is a problem with your hard disk. You should try to find some information about the disk and about spinning it down on the Internet. It could be that it needs special command to reactivate it (which is bad, because than you can't use spindown) or that you can fix it with a firmware upgrade.

Good luck, Dimitri

Comment by proteapermaculture, May 04, 2009

Thanks for this code! Three questions please: -How does it work with laptop mode tools- Is there conflict when laptop mode tools also controls HDD power management? -Does sg_start work differently to hdparm - is it preferable to use one or the other? -Some drive work with different options. whats the difference between --pc=2,3 etc ie command = /usr/bin/sg_start 0 --pc=2 command = /usr/bin/sg_start 0 --pc=3

(Using Ubuntu jaunty on t42 thinkpad)

Comment by Dimitri.Michaux, May 08, 2009

I don't know what happens when your run it with laptop mode tools. Probably the one that spins the disk down first will win. So it might be wise to disable spin down option of laptop mode.

The sg_start tools uses the Linux SCSI Generic driver and I think I have read somewhere that they are going to make all hd drive drivers accessible trough a SCSI compatibility layer. So on old systems/drives you might have more luck with hdparm, but I would use sg_start if it works.

pc stands for power condition, I don't know the difference between the numbers, but if you want to know please look it up and share your findings.

Comment by Kim.Benn, Aug 20, 2009

Missing the changes in init scripts that will substitute lsb functions. Running an old RH4 :-(

Comment by Dimitri.Michaux, Aug 21, 2009

I'm getting pretty fed up with all those init script problems. How do most other project do this? Do they provide init files for every distro? Maybe I should just remove the LSB functions and get it over with?


Sign in to add a comment
Hosted by Google Code