[mythtv-users] optimize before shut down

Peter Bennett pb.mythtv at gmail.com
Tue Apr 23 17:25:40 UTC 2019

What I do is as follows:

I have a script that gets run as the pre-shutdown check command. In 
there I check date and time and decide whether certain things need to be 
done (backup, optimize, other things). If it decides that, for example, 
dailyrun.sh needs to run, it returns 1 to the check and starts up 
dailyrun.sh. It continues to return 1 to the check until dailyrun.sh is 
finished, then returns 0 which allows the shutdown. I keep files in a 
directory with dates so that it knows if something is already run for 
the day and does not run it again.

for my script. It does a lot more than you are looking for, but may give 
you some ideas. That script runs "dailyrun.sh" once a day, the first 
time a shutdown occurs. I am not sure how you will know the last time a 
shutdown occurs for the day, but running your optimize at the first 
shutdown of the day should be just as good.


More information about the mythtv-users mailing list