[debian-edu-commits] debian-edu/ 15/64: * Convert wakeupclients to use syslog.

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


This is an automated email from the git hooks/post-receive script.

sunweaver pushed a commit to branch master
in repository shutdown-at-night.

commit 9922b4cda01b2fce9745c569833bec593a15544e
Author: Petter Reinholdtsen <pere at hungry.com>
Date:   Fri Jun 13 07:34:26 2008 +0000

      * Convert wakeupclients to use syslog.
    
    git-svn-id: svn+ssh://svn.debian.org/svn/debian-edu/trunk/src/shutdown-at-night@41448 6e500793-9bee-0310-a5b0-9d0909bd054d
---
 debian/changelog |    6 ++++++
 wakeupclients    |   12 ++++++++----
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index e6f8a7e..db2649a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+shutdown-at-night (0.3) UNRELEASED; urgency=low
+
+  * Convert wakeupclients to use syslog.
+
+ -- Petter Reinholdtsen <pere at debian.org>  Fri, 13 Jun 2008 09:33:08 +0200
+
 shutdown-at-night (0.2) unstable; urgency=low
 
   * Add server side cron job to start waking up clients Monday-Friday at 06:30.
diff --git a/wakeupclients b/wakeupclients
index b0b8a5d..4ffaa15 100755
--- a/wakeupclients
+++ b/wakeupclients
@@ -3,6 +3,8 @@
 use strict;
 use warnings;
 
+use Sys::Syslog qw(openlog syslog closelog LOG_NOTICE);
+
 my $delay = 5;
 my $wakeuplist = "/etc/shutdown-at-night/clients";
 
@@ -27,11 +29,11 @@ map { $alive{$_} = 1; } get_alive_list(keys %hwaddrs);
 # Start sending wakeup calls
 for my $ip (sort keys %hwaddrs) {
     if (! defined $alive{$ip}) {
-        syslog("sending wake-on-lan package to $ip [$hwaddrs{$ip}]");
+        logmsg("sending wake-on-lan to $ip [$hwaddrs{$ip}]");
         wakeup($ip, $hwaddrs{$ip});
         sleep $delay;
     } else {
-        syslog("not sending wake-on-lan package to already awake $ip [$hwaddrs{$ip}]");
+        logmsg("not sending wake-on-lan to already awake $ip [$hwaddrs{$ip}]");
     }
 }
 
@@ -48,7 +50,9 @@ sub get_alive_list {
     return split(/\s+/, `fping -a @addresses`);
 }
 
-sub syslog {
+sub logmsg {
     my $msg = shift;
-    print "$msg\n";
+    openlog("wakeupclients", undef, 'user');
+    syslog(LOG_NOTICE, "%s", $msg);
+    closelog;
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-edu/pkg-team/shutdown-at-night.git



More information about the debian-edu-commits mailing list