Daemon::Shutdown - A Shutdown Daemon
This is the core of the shutdown daemon script.
use Daemon::Shutdown; my $sdd = Daemon::Shutdown->new( %args ); $sdd->start();
Create new instance of Daemon::Shutdown
Path to log file
Logging level (from Log::Log4perl). Valid are: DEBUG, INFO, WARN, ERROR
If enabled, logging info will be printed to screen as well
If enabled shutdown will not actually be executed.
Time in seconds to sleep before running the monitors. e.g. to give the system time to boot, and not to shut down before users have started using the freshly started system.
If enabled will exit the application after a monitor has triggered. Normally it is a moot point, because if a monitor has triggered, then a shutdown is initialised, so the script will stop running anyway.
A hash of monitor definitions. Each hash key must map to a Monitor module, and contain a hash with the parameters for the module.
Use sudo for shutdown
sudo shutdown -h now
The full path to the shutdown binary
Any args to pass to your shutdown_binary
The number of monitors which need to be triggered at the same time to cause a shutdown. Can be a number or the word 'all'.
Seconds which the system call for shutdown should wait before timing out.
--- log_level: INFO log_file: /var/log/sdd.log shutdown_binary: /sbin/shutdown shutdown_args: - -h - now exit_after_trigger: 0 sleep_before_run: 30 verbose: 0 use_sudo: 0 monitor: hdparm: loop_sleep: 60 disks: - /dev/sdb - /dev/sdc - /dev/sdd
Toggle whether a monitor wants to shutdown and, if enough agree, call shutdown
Shutdown the system, if not in test mode
Start the shutdown daemon
<perl at robinclarke.net>
Please report any bugs or feature requests to https://github.com/robin13/sdd
You can find documentation for this module with the perldoc command.
You can also look for information at:
Copyright 2011 Robin Clarke.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.