Mailing List archive

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

[vdr] Re: Automatic Shutdown while logged in



tom23@web.de(Thomas Mohr)  26.02.02 23:10

Once upon a time Thomas Mohr shaped the electrons to say...

>Hello,

>after producing a coaster while being remotely logged into my VDR
>machine i feel motivated to describe the (little) problem:

>VDR is switched on, and i am logged in with telnet and NFS from my
>other computer. vdr is started using the -s option. There is no easy
>possibility to access the remote control (different floor). Of course,
>vdr shuts down after Setup.MinUserInactivity minutes, which is,
>according to Murphy's law, in the middle of a CD burning activity.

I have had the problem too...compling a new kernel, and argl.. ;-)

I simply added some lines to my poweroff script which
is called by VDR, counting the loggged in users,
exactly said: it checks if no one is logged in.

#!/bin/sh

LOGGER='logger -t pwroff'

touch /tmp/sdsdfsd ; rm /tmp/sdsdfsd
w | grep " 0 user" > /tmp/sdsdfsd
if [ -s  /tmp/sdsdfsd ]
then
  $LOGGER no one logged in
else
  w | grep user | $LOGGER
  exit 1
fi
      
[shut down...]

Instead of that funny touch/rm-construct one might 
try "w | grep " 0 user" >! /tmp/sdsdfsd"
or investigate the error code returned by grep.
(If someone has time to tets all: Please do it and mail the results)

The script works under debian.



>What would be needed is a protection against shutdown while being
>logged into vdr.

>Solutions:

> o SVDRP is also used for LastActivity.

> o Before shutting down, vdr checks if there is someone logged in,
>e.g.    by doing "who". If there is someone logged in, the
>LastActivity is    reset.

See above
The warning will occure for 5 minutes, but nothing will happen
when VDR shuts down. VDR will reset the "user inactivity"
(i assume that if you can't reach the RC you don't watch TV in that
phase)


o a more general solution might be "netstat" 
  and counting the connections. (If you never log on
  on console)




>   This would be the preferred solution, as one can be logged in
>   indefinitely, thus preventing shutdown. After logout, the usual
>   Setup.MinUserInactivity handling shuts the VDR down.

>What do you think ?

That's works for me since month.

One problem is left over, but may be solvable due to
a new parameter was so kind to add:
If i forget to log out and went to TV and tried to turn
of VDR manually with RC this will not work.
But if you are burning a CD this wuld not be what you want.





You can double the if and add an other file:

if [ -e /tmp/dontshutdown ]
then
  exit 1
else
  $LOGGER no one logged in
fi
      
On the logon you do a "touch /tmp/dontshutdown"
and now you can log off! (Sometimes it is not
wanted to be stay logged on.

Nextime you do a "rm  /tmp/dontshutdown"

Too you can add those commands in the command.conf.
So you can prevent shout down temporarly via RC.





Home | Main Index | Thread Index