[debian-edu-commits] debian-edu/shutdown-at-night.git (#12) - master (branch) updated: e5daae71cfeae2c45c6e557bbd9e848f36592856

Mike Gabriel sunweaver at alioth.debian.org
Wed Oct 23 09:23:50 UTC 2013


The branch, master has been updated
       via  e5daae71cfeae2c45c6e557bbd9e848f36592856 (commit)
      from  7d85cad79c2739a1fd64ca312317611a4d47a2e9 (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 e5daae71cfeae2c45c6e557bbd9e848f36592856
Author: Petter Reinholdtsen <pere at hungry.com>
Date:   Fri Jun 13 06:55:33 2008 +0000

      * Change wakeupclients to use fping to check for alive clints, to speed
        up the script.  Reduce sleep time between wakeups to 5 seconds.
    
    git-svn-id: svn+ssh://svn.debian.org/svn/debian-edu/trunk/src/shutdown-at-night@41444 6e500793-9bee-0310-a5b0-9d0909bd054d

-----------------------------------------------------------------------

Summary of changes:
 debian/changelog |    2 ++
 debian/control   |    2 +-
 wakeupclients    |   14 ++++++++------
 3 files changed, 11 insertions(+), 7 deletions(-)

The diff of changes is:
diff --git a/debian/changelog b/debian/changelog
index 1d85c7b..32c8086 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,6 +3,8 @@ shutdown-at-night (0.2) UNRELEASED; urgency=low
   * Add server side cron job to start waking up clients at 06:30.
   * Change wakeupclients to log progress, and to check if a client is up
     before trying to wake it.
+  * Change wakeupclients to use fping to check for alive clints, to speed
+    up the script.  Reduce sleep time between wakeups to 5 seconds.
   * Correct typos in the shutdown-at-night script.
 
  -- Petter Reinholdtsen <pere at debian.org>  Sun,  8 Jun 2008 18:18:53 +0200
diff --git a/debian/control b/debian/control
index 5258be5..2f62fba 100644
--- a/debian/control
+++ b/debian/control
@@ -7,7 +7,7 @@ Build-Depends: debhelper (>= 5), cdbs
 
 Package: shutdown-at-night
 Architecture: all
-Depends: ${misc:Depends}, wakeonlan, ng-utils
+Depends: ${misc:Depends}, wakeonlan, ng-utils, fping
 Recommends: nvram-wakeup
 Description: System to shut down clients at night, and wake them in the morning
  Schedule shutdown in the evening, and uses nvram-wakeup or wakeonlan to wake
diff --git a/wakeupclients b/wakeupclients
index 40fe44f..b0b8a5d 100755
--- a/wakeupclients
+++ b/wakeupclients
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 
-my $delay = 20;
+my $delay = 5;
 my $wakeuplist = "/etc/shutdown-at-night/clients";
 
 my %hwaddrs;
@@ -17,13 +17,16 @@ while (<CLIENTS>) {
 }
 close(CLIENTS);
 
+my %alive;
+map { $alive{$_} = 1; } get_alive_list(keys %hwaddrs);
+
 # Calculate when to start, assuming 20-30 seconds between each host
 #my $duration = $delay * scalar keys %hwaddrs;
 #my $allup = time();
 
 # Start sending wakeup calls
 for my $ip (sort keys %hwaddrs) {
-    if (!alive($ip)) {
+    if (! defined $alive{$ip}) {
         syslog("sending wake-on-lan package to $ip [$hwaddrs{$ip}]");
         wakeup($ip, $hwaddrs{$ip});
         sleep $delay;
@@ -40,10 +43,9 @@ sub wakeup {
     `wakeonlan -i $ip $hwaddr`;
 }
 
-sub alive {
-    my $address = shift;
-    my $retval = system("ping -q -q -c 3 $address >/dev/null");
-    return (0 == $retval);
+sub get_alive_list {
+    my @addresses = @_;
+    return split(/\s+/, `fping -a @addresses`);
 }
 
 sub syslog {


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