freedev / macosx-script-boot-shutdown

This project is useful to execute a shell script during Mac OS X boot or shutdown.
Apache License 2.0
78 stars 23 forks source link

Script does not execute until user interactive session ends #8

Closed ElksInNC closed 10 months ago

ElksInNC commented 1 year ago

I realize this script is 8 years old and probably unmaintained but thought I would leave a comment via this issue anyway for anyone else that has a similar issue.

I am trying to issue "change inputs" commands via DDC using a commandline utility on shutdown. Because the SIGTERM causes the user interactive session to end immediately, the DDC commands can't be sent to the "active" monitors and my script fails.

I tested the same script manually and using "shutdown -h now" and the process works correctly. Not really a bug in the script - just something to be aware of. You can't run a user interactive shutdown script either (I tried to just plug in a "Wait for Keypress" step in the bash script. It never happens in the user interactive space and hangs until the SIGTERM timeout happens.

Alternative was to use Automator to create a Service with the DDC commands as well as a "shutdown" command and then map a new unique keypress to both switch and shutdown. Working for me now.

freedev commented 10 months ago

Hi @ElksInNC sorry for the late answer (one year!), I usually follow my repos but I missed the notification for your comment. Not clear what do you mean for "DDC". Have you figured out the problem?