<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">On 08/08/2015 01:38 PM, Daryl McDonald
wrote:<br>
</div>
<blockquote
cite="mid:CAMwtTBAtHse6kAi3c0RS4n2dBcsq+SyQre=o1pb6ekhkBfEDAQ@mail.gmail.com"
type="cite">
<div dir="ltr"><br>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Sat, Aug 8, 2015 at 1:51 PM,
Douglas Peale <span dir="ltr"><<a moz-do-not-send="true"
href="mailto:Douglas_Peale@comcast.net" target="_blank">Douglas_Peale@comcast.net</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb">
<div class="h5">On 08/08/2015 10:36 AM, Hika van den
Hoven wrote:<br>
> Hoi Douglas,<br>
><br>
> Saturday, August 8, 2015, 7:28:51 PM, you wrote:<br>
><br>
>> On 08/08/2015 07:03 AM, Bill Meek wrote:<br>
>>> On 08/08/2015 01:01 AM, Douglas Peale
wrote:<br>
>>>> I am trying to debug what is going
wrong since upgrading from Mint 17 to Mint 17.2.<br>
>>>> I can't tell if the script in
"Command to set wakeup time" is being run.<br>
>>>><br>
>>>> The original command is<br>
>>>><br>
>>>> sudo sh -c "/usr/bin/setwakeup.sh
$time"<br>
>>>><br>
>>>> . 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<br>
>>>> file.<br>
>>> Hi,<br>
>>><br>
>>> Consider this (*assuming* that the user
running the program<br>
>>> doesn't have write permission to the
file.):<br>
>>><br>
>>> This will fail:<br>
>>> sudo echo blah >> /tmp/blah<br>
>>><br>
>>> This will work:<br>
>>> echo blah | sudo tee -a /tmp/blah<br>
>>><br>
>>> But an echo within the script works (for
me) like the following<br>
>>> which is run as: sudo
/usr/local/bin/SetWakeupTime.sh:<br>
>>><br>
>>> echo "ERROR: Can't write to
${ALARM_FILE}, RC = ${RC}" >> ${ALARM_LOG}<br>
>>><br>
>>> I do have the program name in
/etc/sudoers.d/mythtv.<br>
>>><br>
>> Thanks, I should have guessed the method of
including the output<br>
>> redirection in the script itself since the
script is using that<br>
>> method to write the wakeup time to the rtc.<br>
>> Unfortunately, although the script writes to
the file when I run it<br>
>> on the command line, nothing gets written as
the system<br>
>> shuts itself down.<br>
> I'm not familiar with the script, but try to put
a `sleep 1` command<br>
> after the write. Hopefully the shutdown then
happens after your write<br>
> has finished.<br>
><br>
>> So, although the checklogin.sh script is
being run and writing to<br>
>> the log, it appears the setwakup.sh script is
not being run.<br>
>> I'm stuck, I don't know what I should be
looking for at this point.<br>
>> The following are the contents of the
setwakeup.sh script that was<br>
>> working until I upgraded mint to 17.2.<br>
>> The extra echo commands have been added in an
attempt to debug this problem.<br>
>> $ cat /usr/bin/setwakeup.sh<br>
>> #!/bin/bash<br>
>> #$1 is the first argument to the script. It
is the time in seconds since 1970<br>
>> #this is defined in mythtv-setup with the
time_t argument<br>
>> #I don't know how to ask MythTV for this
value, so it is duplicated here. This is ugly.<br>
>> #number of seconds before scheduled recording
that computer should start booting.<br>
>>
ERRORLOG='/home/dpeale/logs/mythtv/wakeup.log'<br>
>> DATE=`date +%F\ %T\.%N`<br>
>> DATE=${DATE:0:23}<br>
>> startbeforerecord=600<br>
>> #Calculate time_t format time for next non
MythTV event. Note that<br>
>> the user event time is hard coded!<br>
>> # This hard coded time must match the time of
the event you schedule in cron.<br>
>> userevent=$(( $(date -d 3:00AM +%s) -
startbeforerecord ))<br>
>> echo userevent = $userevent
>>${ERRORLOG}<br>
>> (( userevent += ( userevent < $(date +%s)
) ? 24*60*60 : 0 )) # If<br>
>> event time has already passed, add 1 day<br>
>> echo userevent = $userevent
>>${ERRORLOG}<br>
>> # Set wake time to the earliest of MythTVs
wake time and userevent<br>
>> (( waketime = ( userevent < $1 ) ?
userevent : $1 ))<br>
>> echo waketime = $waketime >>${ERRORLOG}<br>
> echo 0 >> /sys/class/rtc/rtc0/wakealarm
#this clears your alarm.<br>
> echo $waketime >>
/sys/class/rtc/rtc0/wakealarm #this writes your
alarm<br>
>> echo $DATE MythTV wants to wake at $1,
waketime actually set to $waketime >>${ERRORLOG}<br>
>> cat /sys/class/rtc/rtc0/wakealarm
>>${ERRORLOG}<br>
><br>
><br>
><br>
><br>
><br>
><br>
> Tot mails,<br>
> Hika mailto:<a
moz-do-not-send="true"
href="mailto:hikavdh@gmail.com">hikavdh@gmail.com</a><br>
><br>
> "Zonder hoop kun je niet leven<br>
> Zonder leven is er geen hoop<br>
> Het eeuwige dilemma<br>
> Zeker als je hoop moet vernietigen om te kunnen
overleven!"<br>
><br>
> De lerende Mens<br>
><br>
> _______________________________________________<br>
> mythtv-users mailing list<br>
> <a moz-do-not-send="true"
href="mailto:mythtv-users@mythtv.org">mythtv-users@mythtv.org</a><br>
> <a moz-do-not-send="true"
href="http://lists.mythtv.org/mailman/listinfo/mythtv-users"
rel="noreferrer" target="_blank">http://lists.mythtv.org/mailman/listinfo/mythtv-users</a><br>
> <a moz-do-not-send="true"
href="http://wiki.mythtv.org/Mailing_List_etiquette"
rel="noreferrer" target="_blank">http://wiki.mythtv.org/Mailing_List_etiquette</a><br>
> MythTV Forums: <a moz-do-not-send="true"
href="https://forum.mythtv.org" rel="noreferrer"
target="_blank">https://forum.mythtv.org</a><br>
><br>
</div>
</div>
I added "sleep 10" to the end of the script, still no
logged evidence that the setwakup.sh script is being run.<br>
<br>
The following is the contents of the log file, showing my
last two attempts at getting this to work. All of the
logged results<br>
are from the checklogin.sh script, none from the
setwakup.sh script.<br>
<br>
2015-08-08 10:09:42.862 Someone is still logged in, don't
shut down!<br>
2015-08-08 10:12:58.001 No one is logged in.<br>
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.<br>
2015-08-08 10:20:02.818 Machine uptime less than 10
minutes, don't shut down.<br>
2015-08-08 10:23:32.813 Machine uptime less than 10
minutes, don't shut down.<br>
2015-08-08 10:26:47.858 Someone is still logged in, don't
shut down!<br>
2015-08-08 10:30:02.811 Someone is still logged in, don't
shut down!<br>
2015-08-08 10:33:32.811 Someone is still logged in, don't
shut down!<br>
2015-08-08 10:36:47.907 Someone is still logged in, don't
shut down!<br>
2015-08-08 10:40:02.814 Someone is still logged in, don't
shut down!<br>
2015-08-08 10:43:32.811 No one is logged in.<br>
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.<br>
2015-08-08 10:47:50.669 Machine uptime less than 10
minutes, don't shut down.<br>
<br>
<br>
_______________________________________________<br>
mythtv-users mailing list<br>
<a moz-do-not-send="true"
href="mailto:mythtv-users@mythtv.org">mythtv-users@mythtv.org</a><br>
<a moz-do-not-send="true"
href="http://lists.mythtv.org/mailman/listinfo/mythtv-users"
rel="noreferrer" target="_blank">http://lists.mythtv.org/mailman/listinfo/mythtv-users</a><br>
<a moz-do-not-send="true"
href="http://wiki.mythtv.org/Mailing_List_etiquette"
rel="noreferrer" target="_blank">http://wiki.mythtv.org/Mailing_List_etiquette</a><br>
MythTV Forums: <a moz-do-not-send="true"
href="https://forum.mythtv.org" rel="noreferrer"
target="_blank">https://forum.mythtv.org</a></blockquote>
<div><br>
</div>
<div>Have you got anything in
"var/log/mythtv/hwclock-rebootTime.log"? This is where I
see evidence of scheduled reboot times. </div>
</div>
<br>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
mythtv-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:mythtv-users@mythtv.org">mythtv-users@mythtv.org</a>
<a class="moz-txt-link-freetext" href="http://lists.mythtv.org/mailman/listinfo/mythtv-users">http://lists.mythtv.org/mailman/listinfo/mythtv-users</a>
<a class="moz-txt-link-freetext" href="http://wiki.mythtv.org/Mailing_List_etiquette">http://wiki.mythtv.org/Mailing_List_etiquette</a>
MythTV Forums: <a class="moz-txt-link-freetext" href="https://forum.mythtv.org">https://forum.mythtv.org</a>
</pre>
</blockquote>
No, This is all that is there:<br>
<br>
$ ls -l /var/log/mythtv<br>
total 45408<br>
-rw-r--r-- 1 syslog adm 7315371 Aug 8 16:24 mythbackend.log<br>
-rw-r--r-- 1 syslog adm 11847692 Feb 17 03:02 mythbackend.log.1<br>
-rw-r--r-- 1 syslog adm 3092887 Jul 29 22:10 mythcommflag.log<br>
-rw-r--r-- 1 syslog adm 9393724 Aug 8 09:59 mythfilldatabase.log<br>
-rw-r--r-- 1 syslog adm 6000978 Aug 2 21:14 mythfrontend.log<br>
-rw-r--r-- 1 syslog adm 1635950 Jul 29 19:20 mythmetadatalookup.log<br>
-rw-r--r-- 1 syslog adm 7067521 Jul 31 22:34 mythpreviewgen.log<br>
-rw-r--r-- 1 syslog adm 96482 Aug 7 23:02 mythtv-setup.log<br>
<br>
</body>
</html>