[mythtv-users] Update to Mint 17.2 broke wakeup function.

Douglas Peale Douglas_Peale at comcast.net
Sat Aug 8 17:28:51 UTC 2015


On 08/08/2015 07:03 AM, Bill Meek wrote:
> On 08/08/2015 01:01 AM, Douglas Peale wrote:
>> I am trying to debug what is going wrong since upgrading from Mint 17 to Mint 17.2.
>> I can't tell if the script in "Command to set wakeup time" is being run.
>>
>> The original command is
>>
>> sudo sh -c "/usr/bin/setwakeup.sh $time"
>>
>> . I tried to add echo commands to the "setwakeup.sh" script, but I can't seem to figure out how to get the results into a log
>> file.
>
> Hi,
>
> Consider this (*assuming* that the user running the program
> doesn't have write permission to the file.):
>
> This will fail:
> sudo echo blah >> /tmp/blah
>
> This will work:
> echo blah | sudo tee -a /tmp/blah
>
> But an echo within the script works (for me) like the following
> which is run as: sudo /usr/local/bin/SetWakeupTime.sh:
>
>     echo "ERROR: Can't write to ${ALARM_FILE}, RC = ${RC}" >> ${ALARM_LOG}
>
> I do have the program name in /etc/sudoers.d/mythtv.
>
Thanks, I should have guessed the method of including the output redirection in the script itself since the script is using that
method to write the wakeup time to the rtc.

Unfortunately, although the script writes to the file when I run it on the command line, nothing gets written as the system
shuts itself down.

So, although the checklogin.sh script is being run and writing to the log, it appears the setwakup.sh script is not being run.

I'm stuck, I don't know what I should be looking for at this point.

The following are the contents of the setwakeup.sh script that was working until I upgraded mint to 17.2.
The extra echo commands have been added in an attempt to debug this problem.
$ cat /usr/bin/setwakeup.sh
#!/bin/bash
#$1 is the first argument to the script. It is the time in seconds since 1970
#this is defined in mythtv-setup with the time_t argument

#I don't know how to ask MythTV for this value, so it is duplicated here. This is ugly.
#number of seconds before scheduled recording that computer should start booting.
ERRORLOG='/home/dpeale/logs/mythtv/wakeup.log'
DATE=`date +%F\ %T\.%N`
DATE=${DATE:0:23}

startbeforerecord=600

#Calculate time_t format time for next non MythTV event. Note that the user event time is hard coded!
# This hard coded time must match the time of the event you schedule in cron.
userevent=$(( $(date -d 3:00AM +%s) - startbeforerecord ))
echo userevent = $userevent >>${ERRORLOG}
(( userevent += ( userevent < $(date +%s) ) ? 24*60*60 : 0 )) # If event time has already passed, add 1 day

echo userevent = $userevent >>${ERRORLOG}
# Set wake time to the earliest of MythTVs wake time and userevent
(( waketime = ( userevent < $1 ) ? userevent : $1 ))

echo waketime = $waketime >>${ERRORLOG}
echo 0 > /sys/class/rtc/rtc0/wakealarm      #this clears your alarm.
echo $waketime > /sys/class/rtc/rtc0/wakealarm     #this writes your alarm
echo $DATE MythTV wants to wake at $1, waketime actually set to $waketime >>${ERRORLOG}
cat /sys/class/rtc/rtc0/wakealarm >>${ERRORLOG}



-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: OpenPGP digital signature
URL: <http://lists.mythtv.org/pipermail/mythtv-users/attachments/20150808/d23a15da/attachment.sig>


More information about the mythtv-users mailing list