mirror of
https://github.com/VDR4Arch/vdr.git
synced 2023-10-10 13:36:52 +02:00
Improved shutdown handling
This commit is contained in:
parent
eeaa969186
commit
1e4c80799f
@ -1536,6 +1536,7 @@ Udo Richter <udo_richter@gmx.de>
|
||||
for adding a missing error report to cCuttingThread::Action()
|
||||
for reporting a problem in handling reallocated memory in cCharSetConv::Convert()
|
||||
for fixing a new[]/delete mismatch in cMenuEditStrItem::LeaveEditMode()
|
||||
for improving shutdown handling
|
||||
|
||||
Sven Kreiensen <svenk@kammer.uni-hannover.de>
|
||||
for his help in keeping 'channels.conf.terr' up to date
|
||||
|
1
HISTORY
1
HISTORY
@ -5497,3 +5497,4 @@ Video Disk Recorder Revision History
|
||||
- Updated the Italian OSD texts (thanks to Diego Pierotto).
|
||||
- The "Play" key now starts replay of the selected recording in the Recordings
|
||||
menu (thanks to Ville Skyttä);
|
||||
- Improved shutdown handling (thanks to Udo Richter).
|
||||
|
13
shutdown.c
13
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)
|
||||
|
4
thread.c
4
thread.c
@ -4,7 +4,7 @@
|
||||
* See the main source file 'vdr.c' for copyright information and
|
||||
* how to reach the author.
|
||||
*
|
||||
* $Id: thread.c 1.62 2007/08/24 13:15:48 kls Exp $
|
||||
* $Id: thread.c 1.63 2007/10/19 14:30:13 kls Exp $
|
||||
*/
|
||||
|
||||
#include "thread.h"
|
||||
@ -518,7 +518,7 @@ int SystemExec(const char *Command, bool Detached)
|
||||
if (Detached) {
|
||||
// Fork again and let first child die - grandchild stays alive without parent
|
||||
if (fork() > 0)
|
||||
exit(0);
|
||||
_exit(0);
|
||||
// Start a new session
|
||||
pid_t sid = setsid();
|
||||
if (sid < 0)
|
||||
|
Loading…
Reference in New Issue
Block a user