0

We have Mac Mini with a classic Mac OS install (12) that runs a command every x minutes within a screen instance using a pipenv command that look like this.

[scripts]
some_pipenv_command="sh -c 'app_dir=$(pwd); while :; do cd $app_dir; python src/mypackage.py; sleep 15; done'"

We had environment issues and working directory issues with watch so we are using a while and change directory as it may have been removed and recreated by the previous execution.

[scripts]
some_pipenv_command="sh -c 'app_dir=$(pwd); while :; do cd $app_dir; python src/mypackage.py; sleep 15; done'"

We have a quantum bug that disappears when we look at it.

It sometimes feels that the system has crashed... Yet as soon as we connect to the screen it runs smoothly.

There is nothing exceptional in mypackage.py and it has never hung during development. It mostly runs a job depending on a webservice, 99.9% of the time it just makes three curl calls and the whole execution might be below a second. The remaining 0.01% the execution can take a few minutes (< 3).

So we have added a log in mypackage.py. We observe the following.

We should have a bit less than 60 * 60 / 15 = 240 calls per hour. We never have them.

For about three hours per day : we reach above 10 calls, rarely above 20 but for some above 60. Between 5 and 6h, 11 and 12h, and 18 and 19h.

I assume something is trying to spare energy but I can't find what and I can't find how to disable it.

AsTeR
  • 237
  • 4
  • 13

1 Answers1

0

System preferences > Energy saver, check the box Prevent computer from sleeping automatically when the display is off

That was the stupid question of the month.

I guess it was still working from time to time because of some internal network waking it up randomly make the problem harder to identify.

AsTeR
  • 237
  • 4
  • 13