<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<br>
<br>
<div class="moz-cite-prefix">On 4/23/19 1:36 PM, Daryl McDonald
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAMwtTBAU3whQfwiBkkrzDRd1qkG91oHV1sPbciS91vxsNWyE6Q@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<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" moz-do-not-send="true">pb.mythtv@gmail.com</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;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"
moz-do-not-send="true">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:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
</blockquote>
</div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></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>
</body>
</html>