Author: dmeyer
Date: Mon Feb  6 19:20:34 2006
New Revision: 7916

Modified:
   trunk/apps/bin/freevo-autoshutdown

Log:
improve debug

Modified: trunk/apps/bin/freevo-autoshutdown
==============================================================================
--- trunk/apps/bin/freevo-autoshutdown  (original)
+++ trunk/apps/bin/freevo-autoshutdown  Mon Feb  6 19:20:34 2006
@@ -137,8 +137,6 @@
     Class handling system shutdown.
     """
     def __init__(self):
-        # notifier check timer
-        kaa.notifier.Timer(self.check_shutdown).start(60)
         # counter how often the shutdown function warns before real
         # shutdown (31 == 30 minutes)
         self.shutdown_counter = 31
@@ -158,6 +156,8 @@
         self.important_apps = important_apps[:]
         for app in config.important_apps.split(','):
             self.important_apps.append(app.strip())
+        # check shutdown (timer based)
+        self.check_shutdown()
 
 
 
@@ -178,7 +178,7 @@
                 f = open(cmdline)
                 cmd = os.path.basename(f.readline().split('\0')[0])
                 if cmd in self.important_apps:
-                    log.info('%s is running, not ready for shutdown' % cmd)
+                    log.debug('%s is running, not ready for shutdown' % cmd)
                     return False
                 f.close()
         return True
@@ -228,6 +228,7 @@
         return idle, busy, wakeup
 
 
+    @kaa.notifier.execute_in_timer(kaa.notifier.Timer, 60)
     def check_shutdown(self):
         """
         Check if shutdown is possible and shutdown the system.
@@ -239,26 +240,27 @@
             # there is a new wakeup time
             self.wakeuptime = wakeuptime
             if config.wakeup_command:
-                log.info('Set wakeup time: %s' % wakeuptime)
+                wakestr = time.strftime('%a %b %d, %H:%M', 
time.localtime(wakeuptime))
+                log.info('Set wakeup time: %s' % wakestr)
                 kaa.notifier.Process(config.wakeup_command % 
wakeuptime).start()
             else:
                 log.error('wakeup_command not set')
         # check idletime
         if idletime < config.freevo_idletime:
-            log.info('Entity idletime is %s, continue' % idletime)
+            log.debug('Entity idletime is %s, continue' % idletime)
             self.shutdown_counter = max(self.shutdown_counter, 6)
             return True
 
         # check busy time
         if busytime:
-            log.info('Entity is busy at least %s minutes' % busytime)
+            log.debug('Entity is busy at least %s minutes' % busytime)
             self.shutdown_counter = max(self.shutdown_counter, 6)
             return True
 
         # check wakeup time
         wakeup = int((wakeuptime - time.time()) / 60)
         if wakeuptime and wakeup < 30:
-            log.info('Wakeup time is in %s minutes, do not shutdown' % wakeup)
+            log.debug('Wakeup time is in %s minutes, do not shutdown' % wakeup)
             self.shutdown_counter = max(self.shutdown_counter, 6)
             return True
 
@@ -274,7 +276,7 @@
             idle = self.check_login()
             if idle < 1000:
                 # there is a login, print idle time for debug
-                log.info('user idle time: %s minutes' % idle)
+                log.debug('user idle time: %s minutes' % idle)
             if idle <= config.user_idletime:
                 self.shutdown_counter = max(self.shutdown_counter, 6)
                 return True


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to