[mythtv-users] MythTV Pre Shutdown Check command

Glen Hawksworth glenhawk at optusnet.com.au
Sat Jul 12 12:21:56 UTC 2008


I have the need to setup a Myth box with automatic shutdown and startup.
I can handle the ACPI setup, I can get it to turn on in time to tape the
show and then shutdown again but I would like a way (other than having a
frontend running) to prevent the system from shutting down.

I need this because in addition to being a Mythbox, this will also be a
personal computer for internet, word processing, the occasional game,
etc.
What I was thinking was that if the system was at the login screen then
it can shutdown. If the system is logged in (even if a front end is not
running) then it wont automatically shutdown. The idea would be that the
user would not shutdown their PC but instead when they are finished with
it they would just log out leaving the PC to decide if it can shutdown.

I have not learnt how to write scripts yet, and I imagine that this is
what I will need to do. Could someone please let me know how to modify
the following script from
https://help.ubuntu.com/community/MythTV/Install/WhatNext/ACPIWake to
achieve what I have outlined above?
Thanks in advance,
Glen


#

# MythShutdownCheck
#
# checks to see if any other user is
# logged in before idle shutdown
#
# returns "1" if yes, stopping shutdown
# returns "0" if ok to shutdown
#

if last | head | grep -q "pts/.*still logged in"   # check for active *remote* login?

then
   exit 1

else
   exit 0
fi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mythtv.org/pipermail/mythtv-users/attachments/20080712/ff45f851/attachment.htm 


More information about the mythtv-users mailing list