<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Apr 23, 2019 at 2:29 PM Peter Bennett <<a href="mailto:pb.mythtv@gmail.com">pb.mythtv@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div bgcolor="#FFFFFF">
<br>
<br>
<div class="gmail-m_-1825837401727835657moz-cite-prefix">On 4/23/19 1:36 PM, Daryl McDonald
wrote:<br>
</div>
<blockquote type="cite">
<div dir="auto">
<div><br>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Tue, Apr 23, 2019,
13:27 Peter Bennett <<a href="mailto:pb.mythtv@gmail.com" target="_blank">pb.mythtv@gmail.com</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
What I do is as follows:<br>
<br>
I have a script that gets run as the pre-shutdown check
command. In <br>
there I check date and time and decide whether certain
things need to be <br>
done (backup, optimize, other things). If it decides that,
for example, <br>
dailyrun.sh needs to run, it returns 1 to the check and
starts up <br>
dailyrun.sh. It continues to return 1 to the check until
dailyrun.sh is <br>
finished, then returns 0 which allows the shutdown. I keep
files in a <br>
directory with dates so that it knows if something is
already run for <br>
the day and does not run it again.<br>
<br>
See <br>
<a href="https://github.com/bennettpeter/mythscripts/blob/master/install/opt/mythtv/bin/mythshutdown.sh" rel="noreferrer noreferrer" target="_blank">https://github.com/bennettpeter/mythscripts/blob/master/install/opt/mythtv/bin/mythshutdown.sh</a>
<br>
for my script. It does a lot more than you are looking
for, but may give <br>
you some ideas. That script runs "dailyrun.sh" once a day,
the first <br>
time a shutdown occurs. I am not sure how you will know
the last time a <br>
shutdown occurs for the day, but running your optimize at
the first <br>
shutdown of the day should be just as good.<br>
<br>
Peter<br>
_________________________________________<br>
</blockquote>
</div>
</div>
<div dir="auto"><br>
</div>
<div dir="auto">Yes Peter I think this is more of what I'm
looking for, my question now is, since I already have a pre
shutdown check working (to check if I'm logged in or not) how
can these two be combined or will yours do what mine is
already doing and thereby repaceable?</div>
<div dir="auto">
<div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
</blockquote>
</div>
</div>
</div>
<br>
<fieldset class="gmail-m_-1825837401727835657mimeAttachmentHeader"></fieldset>
<br>
</blockquote>
There are checks for users logged in via ssh, but you cannot just
plug that script into your system. It has many other things that
will not work for you without appropriate setups.<br>
</div>
___________________________________________<br></blockquote><div><br></div><div>It occurred to me I might be better off asking my son to adapt the check login script I'm using now to include the optimize script. Thanks to all for the input.</div></div></div>