[debian-edu-commits] debian-edu/shutdown-at-night.git (#10) - master (branch) updated: 86faa6df4b138fce8622ee90a3e1d83a23de70c0
Mike Gabriel
sunweaver at alioth.debian.org
Wed Oct 23 09:23:49 UTC 2013
The branch, master has been updated
via 86faa6df4b138fce8622ee90a3e1d83a23de70c0 (commit)
from c21bd82b824304cac0b4df3d905181e377eb60cb (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 86faa6df4b138fce8622ee90a3e1d83a23de70c0
Author: Petter Reinholdtsen <pere at hungry.com>
Date: Thu Jun 12 07:16:31 2008 +0000
* Change wakeupclients to log progress, and to check if a client is up
before trying to wake it.
git-svn-id: svn+ssh://svn.debian.org/svn/debian-edu/trunk/src/shutdown-at-night@41442 6e500793-9bee-0310-a5b0-9d0909bd054d
-----------------------------------------------------------------------
Summary of changes:
debian/changelog | 2 ++
wakeupclients | 22 +++++++++++++++++++---
2 files changed, 21 insertions(+), 3 deletions(-)
The diff of changes is:
diff --git a/debian/changelog b/debian/changelog
index d0db804..0704346 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,6 +1,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.
-- Petter Reinholdtsen <pere at debian.org> Sun, 8 Jun 2008 18:18:53 +0200
diff --git a/wakeupclients b/wakeupclients
index 683e531..40fe44f 100755
--- a/wakeupclients
+++ b/wakeupclients
@@ -22,9 +22,14 @@ close(CLIENTS);
#my $allup = time();
# Start sending wakeup calls
-for my $ip (keys %hwaddrs) {
- wakeup($ip, $hwaddrs{$ip});
- sleep $delay;
+for my $ip (sort keys %hwaddrs) {
+ if (!alive($ip)) {
+ syslog("sending wake-on-lan package to $ip [$hwaddrs{$ip}]");
+ wakeup($ip, $hwaddrs{$ip});
+ sleep $delay;
+ } else {
+ syslog("not sending wake-on-lan package to already awake $ip [$hwaddrs{$ip}]");
+ }
}
# exit
@@ -34,3 +39,14 @@ sub wakeup {
my ($ip, $hwaddr) = @_;
`wakeonlan -i $ip $hwaddr`;
}
+
+sub alive {
+ my $address = shift;
+ my $retval = system("ping -q -q -c 3 $address >/dev/null");
+ return (0 == $retval);
+}
+
+sub syslog {
+ my $msg = shift;
+ print "$msg\n";
+}
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