View unanswered posts    View active topics

All times are UTC - 6 hours

Post new topic Reply to topic  [ 1 post ] 
Print view Previous topic   Next topic  
Author Message
Search for:
PostPosted: Sun Sep 24, 2006 3:41 am 
Joined: Mon Feb 06, 2006 5:11 pm
Posts: 353
Location: Brisbane, Australia
Hi All,

I didn't like the current wakeup test ( at the KnoppMythWiki as it didn't take into account the user wakeup periods for performing system tasks etc. I wrote some dodgy code that checks the values stored by NVRAM_WAKEUP and if it is within 10 minutes of the current time then an automated powerup must have been performed.

The routine looks for particular paterns returned by NVRAM_WAKEUP to gather day, hour, minutes and converts everything to minutes since the start of the month, accordingly it will not perform to well at the roll over time at midnight at the end of the month.

To everyone who has contributed to Knoppmyth and Mythtv, Thank you.

#Alternative method for checking reason for powerup.
#Checks values stored in NVRAM_WAKEUP and if within 10 minutes,
#then must be due to automated processes.

#Doesn't handle time period around midnight of last night of month


#Get time stored in NVRAM
NVRAM_DAY="`sudo nvram-wakeup |awk '$1=="Day" { print $3 }'`"
NVRAM_HOUR="`sudo nvram-wakeup |awk '$1=="rtcHour" { print $3 }'`"
NVRAM_MIN="`sudo nvram-wakeup |awk '$1=="rtcMin" { print $3 }'`"



#Get current date (remove '-u' option for non utc time)
DATE="`date -u +%e%t%H%t%M`"

#parse Date
NOW_DAY="`echo $DATE|awk '{ print $1 }'`"
NOW_HOUR="`echo $DATE|awk '{ print $2 }'`"
NOW_MIN="`echo $DATE|awk '{ print $3 }'`"


let "NOW_TIME = NOW_DAY*24*60 + NOW_HOUR*60 + NOW_MIN"
#Time 10 minuts ago
let "THEN_TIME = NOW_TIME - 10"

if [ "$NVRAM_TIME" -ge "$THEN_TIME" ]; then
   if [ "$NVRAM_TIME" -le "$NOW_TIME" ]; then
     echo "Automated wakeup, killing Mythfrontend"
     sleep 30
     killall mythfrontend
     echo "Automated wakeup is in future"
  echo "Automated wakeup in in past"


Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 6 hours

Who is online

Users browsing this forum: No registered users and 1 guest

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group

Theme Created By ceyhansuyu