How to correctly manually set timers to force processes to quit in 10.12

Discussion in 'Mac Programming' started by Susurs, Dec 6, 2016.

  1. Susurs macrumors 6502

    Susurs

    Joined:
    Jun 18, 2010
    #1
    Could somebody, please advise me on how to correctly manually set timers to force processes to quit when mac is shutting down in macOS Sierra?

    Commands below were working in Yosemite but does not work in Sierra (10.12.1):

    sudo defaults write /System/Library/LaunchAgents/com.apple.coreservices.appleid.authentication ExitTimeOut -int 1

    sudo defaults write /System/Library/LaunchDaemons/com.apple.coreservices.appleevents ExitTimeOut -int 1

    sudo defaults write /System/Library/LaunchDaemons/com.apple.diskarbitrationd ExitTimeOut -int 1

    sudo defaults write /System/Library/LaunchDaemons/com.apple.mDNSResponder ExitTimeOut -int 1

    sudo defaults write /System/Library/LaunchDaemons/com.apple.securityd ExitTimeOut -int 1



    Not a programmer, so I am sorry if I say something totally wrong :):)

    Terminal gives me: Could not write to domain...


    Maybe some info on the following pages could help to answer my question:

    On Launchd: http://www.launchd.info/

    The Life Cycle of a Daemon. Terminating processes:
    https://developer.apple.com/library...ptual/BPSystemStartup/Chapters/Lifecycle.html


    P.S. Here is my com.apple.coreservices.appleid.authentication .plist in /system/Library/LaunchAgents...

    < ?xml version="1.0" encoding="UTF-8"?>
    < !DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">

    < plist version="1.0">
    < dict>
    < key>Label</key>
    < string>com.apple.coreservices.appleid.authentication</string>
    < key>LimitLoadToSessionType</key>
    < array>
    < string>Aqua</string>
    < string>LoginWindow</string>
    < /array>
    < key>MachServices</key>
    < dict>
    < key>com.apple.coreservices.appleid.aps</key>
    < true/>
    < key>com.apple.coreservices.appleid.authentication</key>
    < true/>
    < /dict>
    < key>POSIXSpawnType</key>
    < string>Adaptive</string>
    < key>Program</key>
    < string>/System/Library/CoreServices/AppleIDAuthAgent</string>
    < key>RunAtLoad</key>
    < true/>
    < /dict>
    < /plist>
    --- Post Merged, Dec 6, 2016 ---
    Could I try to manually add ExitTimeOut or this is not the case/not possible anyway?
    <key>ExitTimeOut</key>
    <integer>500</integer>
     
  2. chown33 macrumors 604

    Joined:
    Aug 9, 2009
    #2
    If System Integrity Protection (SIP) is enabled, as it is by default, you can't modify any files in /System/Library.

    To check the status of SIP, type this in a Terminal window:
    Code:
    csrutil status
    If it's enabled, you'll need to disable it. You should carefully consider whether to take this path.

    If it's disabled, then post again, because the plist files should be writable.


    More info:
    https://en.wikipedia.org/wiki/System_Integrity_Protection
    Configuring System Integrity Protection - Apple Developer
     
  3. Susurs thread starter macrumors 6502

    Susurs

    Joined:
    Jun 18, 2010
    #3
    Thank you very much! SIP was the problem! Disabled it and was able to run commands correctly.

    I enabled SIP again afterwards.

    A bit different question (probably wrong thread to ask as well...but still...somehow connected to shutdown as well). I upgraded my Macbook Pro (2013) to Sierra 2 days ago, and this morning I noticed that fans stay on for some 5-10 seconds after shutdown (screen off/lights off). Is this a normal behaviour? It didn'happen in 10.10.
     
  4. chown33 macrumors 604

    Joined:
    Aug 9, 2009
    #4
    Glad it worked.

    And good idea re-enabling SIP.

    I don't know. You should ask on a forum like Mac Basics.
     

Share This Page