A
A
Anton Kokarev2019-01-06 19:19:04
macOS
Anton Kokarev, 2019-01-06 19:19:04

The daemon on Mac OS does not have time to shut down on SHUTDOWN. How to fix?

I am writing a daemon/agent to execute a number of commands before shutting down macOS. The agent starts successfully at system startup and hangs in the list of running tasks. If I send it from the console kill -term 1234, then everything works fine, the necessary commands are executed. But as soon as I try to turn off the computer through the Apple-Shutdown menu, my demon does not even have time to sneeze, as the system nails it. As I understand it, the problem is that the launchd system process gives too little time between sending the SIGTERM signal and SIGKILL. Probably the ExitTimeOut key set to 0 (infinite) should solve the problem, but does not. What am I doing wrong? What else can you think of?
Initially, the problem is that vagrant does not track system shutdowns, and VirtualBox, working in the background, instead of sending an acpi signal to the guest system, simply cuts off the power.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question