summaryrefslogtreecommitdiff
path: root/shutdown.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2007-10-19 14:37:03 +0200
committerKlaus Schmidinger <vdr@tvdr.de>2007-10-19 14:37:03 +0200
commit1e4c80799fd17b1b0841d7108ee752b685f72dba (patch)
tree91db4353fcb14430aab20ee7f65263d52468f82b /shutdown.c
parenteeaa969186650ed419404a76453140a9c91f47d1 (diff)
downloadvdr-1e4c80799fd17b1b0841d7108ee752b685f72dba.tar.gz
vdr-1e4c80799fd17b1b0841d7108ee752b685f72dba.tar.bz2
Improved shutdown handling
Diffstat (limited to 'shutdown.c')
-rw-r--r--shutdown.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/shutdown.c b/shutdown.c
index 4029a78c..4fde5440 100644
--- a/shutdown.c
+++ b/shutdown.c
@@ -6,7 +6,7 @@
*
* Original version written by Udo Richter <udo_richter@gmx.de>.
*
- * $Id: shutdown.c 1.1 2007/02/24 17:24:11 kls Exp $
+ * $Id: shutdown.c 1.2 2007/10/19 14:33:40 kls Exp $
*/
#include "shutdown.h"
@@ -110,9 +110,11 @@ void cShutdownHandler::CheckManualStart(int ManualStart)
// Set inactive after MinUserInactivity
SetUserInactiveTimeout();
}
- else
+ else {
// Set inactive from now on
+ dsyslog("scheduled wakeup time in %ld minutes, assuming automatic start of VDR", Delta / 60);
SetUserInactive();
+ }
}
void cShutdownHandler::SetShutdownCommand(const char *ShutdownCommand)
@@ -126,8 +128,13 @@ void cShutdownHandler::CallShutdownCommand(time_t WakeupTime, int Channel, const
time_t Delta = WakeupTime ? WakeupTime - time(NULL) : 0;
cString cmd = cString::sprintf("%s %ld %ld %d \"%s\" %d", shutdownCommand, WakeupTime, Delta, Channel, *strescape(File, "\"$"), UserShutdown);
isyslog("executing '%s'", *cmd);
- if (SystemExec(cmd, true) == 0)
+ int Status = SystemExec(cmd, true);
+ if (!WIFEXITED(Status) || WEXITSTATUS(Status))
+ esyslog("SystemExec() failed with status %d", Status);
+ else {
Setup.NextWakeupTime = WakeupTime; // Remember this wakeup time for comparison on reboot
+ Setup.Save();
+ }
}
void cShutdownHandler::SetUserInactiveTimeout(int Seconds, bool Force)