Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[vdr] Re: Automatic Shutdown while logged in



Klaus Schmidinger wrote:
> 
> Klaus Schmidinger wrote:
> >
> > Thomas Mohr wrote:
....
> > > Solutions:
> > >
> > >  o SVDRP is also used for LastActivity.
> > >    Currently the svdrp.c code takes a timestamp to decide
> > >    when the port has a timeout, but does not update the
> > >    LastActivity from vdr.c
> >
> > Ok, sounds like a reasonable idea to reset the timeout when there
> > is SVDRP activity.
> 
> I gave this some more thought and decided not to do this, because
> if you have, for instance, a mechanism that sends a prompt message
> to VDR whenever a new email arrives, there could be SVDRP connections
> every now and then and thus the timeout would never happen.

No problem to skip this. As a followup, here is the perl code for the
second solution, which is cleaner anyhow. As pointed out by you and
others, it is no problem not to react on the shutdown script call, it
will be repeated.

Checking if nobody is logged in and furthermore shutting down:

------------------------vdrsettime--------------------------------
$whos = `who | wc -l`;

if ( int($whos) == 0 )
{
   # nobody logged in -> shut down
   system( "nohup sh -c \"(sleep 10; killall -HUP vdr) \" &" );
}
-----------------------------------------------------------------

 - Thomas



Home | Main Index | Thread Index