[debian-edu-commits] debian-edu/shutdown-at-night.git (#17) - master (branch) updated: c1fa6b35ed41260779d9a9a4140fd5dd67866a37
Mike Gabriel
sunweaver at alioth.debian.org
Wed Oct 23 09:52:05 UTC 2013
The branch, master has been updated
via c1fa6b35ed41260779d9a9a4140fd5dd67866a37 (commit)
from 562f8d74931323009c398c6eed12ea4e6259f4d4 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit c1fa6b35ed41260779d9a9a4140fd5dd67866a37
Author: Petter Reinholdtsen <pere at hungry.com>
Date: Fri Jun 13 08:57:37 2008 +0000
* Add support in wakeupclients to run a script
/etc/shutdown-at-night/clients-generator to extract the clients to
wake up dynamically.
git-svn-id: svn+ssh://svn.debian.org/svn/debian-edu/trunk/src/shutdown-at-night@41450 6e500793-9bee-0310-a5b0-9d0909bd054d
-----------------------------------------------------------------------
Summary of changes:
debian/changelog | 3 +++
wakeupclients | 30 +++++++++++++++++++++++-------
2 files changed, 26 insertions(+), 7 deletions(-)
The diff of changes is:
diff --git a/debian/changelog b/debian/changelog
index 4ec8e6b..1889c7c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,6 +3,9 @@ shutdown-at-night (0.3) UNRELEASED; urgency=low
* Convert wakeupclients to use syslog.
* Add suggests on sitesummary (>= 0.0.41) to suggest a version that
can generate the client list automatically.
+ * Add support in wakeupclients to run a script
+ /etc/shutdown-at-night/clients-generator to extract the clients to
+ wake up dynamically.
-- Petter Reinholdtsen <pere at debian.org> Fri, 13 Jun 2008 09:33:08 +0200
diff --git a/wakeupclients b/wakeupclients
index 4ffaa15..5139c13 100755
--- a/wakeupclients
+++ b/wakeupclients
@@ -7,17 +7,33 @@ use Sys::Syslog qw(openlog syslog closelog LOG_NOTICE);
my $delay = 5;
my $wakeuplist = "/etc/shutdown-at-night/clients";
+my $wakeupgenerator = "/etc/shutdown-at-night/clients-generator";
my %hwaddrs;
-# Locate hosts to wake up
-open(CLIENTS, "<", $wakeuplist) || exit 0;
-while (<CLIENTS>) {
- chomp;
- my ($ip, $hwaddr) = split(/\s+/);
- $hwaddrs{$ip} = $hwaddr;
+sub load_clients {
+ my $fh = shift;
+ while (<$fh>) {
+ chomp;
+ my ($ip, $hwaddr) = split(/\s+/);
+ $hwaddrs{$ip} = $hwaddr;
+ }
+}
+
+# Locate hosts to wake up, from file
+if ( -f $wakeuplist ) {
+ if (open(CLIENTS, "<", $wakeuplist)) {
+ load_clients(*CLIENTS);
+ close(CLIENTS);
+ }
+}
+# Or using a dynamic script
+if ( -x $wakeupgenerator ) {
+ if (open(CLIENTS, "$wakeupgenerator |")) {
+ load_clients(*CLIENTS);
+ close(CLIENTS);
+ }
}
-close(CLIENTS);
my %alive;
map { $alive{$_} = 1; } get_alive_list(keys %hwaddrs);
hooks/post-receive
--
shutdown-at-night.git (shutdown-at-night Debian package)
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "shutdown-at-night.git" (shutdown-at-night Debian package).
More information about the debian-edu-commits
mailing list