[mythtv-users] simple shutdown script
Paul Harrison
mythtv at dsl.pipex.com
Thu Jul 27 17:33:45 UTC 2006
Tim Plessers wrote:
> Hi,
>
> My mythbox-BIOS is configured to auto-startup every day at 5pm. I would
> like to create a cronjob-script that shuts down the box after 1 am, ONLY
> when no more recordings are scheduled untill 5pm (when it starts up
> again). If recordings were found, it will do the check again after one
> hour, etc. This way, I can save power consumption without manually
> shutting down the box every day. Also, mplayer should not be running
> because I don't want the box to shutdown while I'm looking at a
> recording at 1am. My backend and frontend are on the same machine.
>
> Does such a script already exists, if so, where can I find it? If not,
> please help me out :
>
>
> pseudo-code (I know, I suck at writing scripts) :
>
> #!/bin/bash
> if ((mysql-command to count number of recordings till 5pm) == 0)
> && ((ps -ef | grep mplayer) returns nothing))
> {
> shutdown -h now
> }
>
> Thanks for your input,
>
> Tim Plessers
Have you had a look at MythWelcome it may already do what you want?
MythWelcome has a daily wakeup/shutdown feature where you can define up
to 2 periods in the day where you would like your myth system to be
awake even if it is idle. You would have to let nvram-wakeup set the
next wakeup time in the BIOS for you. Once you have everything setup
your system would both wake up to record something or wake up between
5pm and 1am automatically. One gotcha at the moment is the daily wakeup
periods cannot cross midnight so you would have to have one period for
5pm to midnight and an other from midnight to 1am to achieve what you want.
Paul H.
More information about the mythtv-users
mailing list