launchd start automatically

132 views Asked by At

Trying to create a task that starts on every day at 4AM to restart my mac and execute some maintenance scripts. This is my script:

<?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>local.job</string>
    <key>ProgramArguments</key>
    <array>
            <string>/usr/bin/osascript</string>
            <string>/Users/Media/Scripts/RestartMac.scpt</string>
    </array>
    <key>RunAtLoad</key>
    <false/>
    <key>StandardErrorPath</key>
    <string>/Users/Media/Scripts/Output/RestartMac.txt</string>
    <key>StandardOutPath</key>
    <string>/Users/Media/Scripts/Output/RestartMac.txt</string>
    <key>StartCalendarInterval</key>
    <array>
            <dict>
                    <key>Hour</key>
                    <integer>04</integer>
                    <key>Minute</key>
                    <integer>00</integer>
            </dict>
    </array>
</dict>
</plist>

If i run launchctl unload / load to reload my plist file it will execute the script. I am a bit confused cause i have set the RunAtLoad parameter to false. Tried a lot of things but i am unable to get it running. Has anyone an idea what is my fault here?

Operation system: OS X 10.9

1

There are 1 answers

0
Michael Pruskowski On

have you tried

<key>AbandonProcessGroup</key>
<true/>