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

Daryl McDonald darylangela at gmail.com
Sat Aug 8 20:38:43 UTC 2015


On Sat, Aug 8, 2015 at 1:51 PM, Douglas Peale <Douglas_Peale at comcast.net>
wrote:

> On 08/08/2015 10:36 AM, Hika van den Hoven wrote:
> > Hoi Douglas,
> >
> > Saturday, August 8, 2015, 7:28:51 PM, you wrote:
> >
> >> 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.
> > I'm not familiar with the script, but try to put a `sleep 1` command
> > after the write. Hopefully the shutdown then happens after your write
> > has finished.
> >
> >> 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}
> >
> >
> >
> >
> >
> >
> > Tot mails,
> >   Hika                            mailto:hikavdh at gmail.com
> >
> > "Zonder hoop kun je niet leven
> > Zonder leven is er geen hoop
> > Het eeuwige dilemma
> > Zeker als je hoop moet vernietigen om te kunnen overleven!"
> >
> > De lerende Mens
> >
> > _______________________________________________
> > mythtv-users mailing list
> > mythtv-users at mythtv.org
> > http://lists.mythtv.org/mailman/listinfo/mythtv-users
> > http://wiki.mythtv.org/Mailing_List_etiquette
> > MythTV Forums: https://forum.mythtv.org
> >
> I added "sleep 10" to the end of the script, still no logged evidence that
> the setwakup.sh script is being run.
>
> The following is the contents of the log file, showing my last two
> attempts at getting this to work. All of the logged results
> are from the checklogin.sh script, none from the setwakup.sh script.
>
> 2015-08-08 10:09:42.862 Someone is still logged in, don't shut down!
> 2015-08-08 10:12:58.001 No one is logged in.
> 2015-08-08 10:12:58.001 User script is not running and there is lots of
> time before it needs to start, shut down.
> 2015-08-08 10:20:02.818 Machine uptime less than 10 minutes, don't shut
> down.
> 2015-08-08 10:23:32.813 Machine uptime less than 10 minutes, don't shut
> down.
> 2015-08-08 10:26:47.858 Someone is still logged in, don't shut down!
> 2015-08-08 10:30:02.811 Someone is still logged in, don't shut down!
> 2015-08-08 10:33:32.811 Someone is still logged in, don't shut down!
> 2015-08-08 10:36:47.907 Someone is still logged in, don't shut down!
> 2015-08-08 10:40:02.814 Someone is still logged in, don't shut down!
> 2015-08-08 10:43:32.811 No one is logged in.
> 2015-08-08 10:43:32.811 User script is not running and there is lots of
> time before it needs to start, shut down.
> 2015-08-08 10:47:50.669 Machine uptime less than 10 minutes, don't shut
> down.
>
>
> _______________________________________________
> mythtv-users mailing list
> mythtv-users at mythtv.org
> http://lists.mythtv.org/mailman/listinfo/mythtv-users
> http://wiki.mythtv.org/Mailing_List_etiquette
> MythTV Forums: https://forum.mythtv.org


Have you got anything in "var/log/mythtv/hwclock-rebootTime.log"? This is
where I see evidence of scheduled reboot times.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mythtv.org/pipermail/mythtv-users/attachments/20150808/401df3f0/attachment.html>


More information about the mythtv-users mailing list