[debian-edu-commits] debian-edu/ 06/64: Allow clients to be enabled using the netgroup host-shutdown-at-night.

Mike Gabriel sunweaver at debian.org
Wed Oct 23 09:51:49 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 597ebc8f87cc6722ebcbc6bc0043e79f92bb9ea5
Author: Petter Reinholdtsen <pere at hungry.com>
Date:   Sun Jun 8 16:14:08 2008 +0000

    Allow clients to be enabled using the netgroup host-shutdown-at-night.
    
    git-svn-id: svn+ssh://svn.debian.org/svn/debian-edu/trunk/src/shutdown-at-night@41395 6e500793-9bee-0310-a5b0-9d0909bd054d
---
 README            |    3 ++-
 debian/control    |    2 +-
 shutdown-at-night |   13 +++++++------
 3 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/README b/README
index f9a0fcf..46b282b 100644
--- a/README
+++ b/README
@@ -9,7 +9,8 @@ them automatically on in the morning.
  - use wake on lan or nvram-wakeup
 
 To enable automatic shutdown, touch
-/etc/shutdown-at-night/shutdown-at-night
+/etc/shutdown-at-night/shutdown-at-night, or add the hostname to the
+netgroup "host-shutdown-at-night".
 
 To enable wakeonlan, add the clients to
 /etc/shutdown-at-night/clients, with one line per client, IP address
diff --git a/debian/control b/debian/control
index 2ce028c..5258be5 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
+Depends: ${misc:Depends}, wakeonlan, ng-utils
 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/shutdown-at-night b/shutdown-at-night
index 2dced23..2d1f213 100755
--- a/shutdown-at-night
+++ b/shutdown-at-night
@@ -8,20 +8,21 @@
 
 wakeuptime="07:00"
 
-hostname=$(uname -n)
+hostname="$(uname -n)"
+netgroupname="host-shutdown-at-night"
+
+in_netgroup() {
+    innetgr -h "$hostname" "$netgroupname"
+}
 
 enabled_for_host() {
     # Flag for now
-    if [ -f /etc/shutdown-at-night/shutdown-at-night ] ; then
+    if [ -f /etc/shutdown-at-night/shutdown-at-night ] || in_netgroup; then
         true
     fi
     false;
 }
 
-netgroup_lookup() {
-    innetgr -h $hostname host-shutdown-at-night
-}
-
 nvramwakeup() {
 # http://www.vdr-portal.de/board/thread.php?threadid=75582&sid=b7aced20e710aef12ffa56b5197fe168
     wakeuptime=$1

-- 
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