Launchd plist runs everyday instead of only weekends

daemonslaunchdplistschedule

Scenario: I need to force a reboot as a Launch Daemon at a specific time only on Saturdays and Sundays.

Output

The reboot command gets launched at the specific time everyday instead only on Saturdays and Sundays. LaunchControl GUI even reads the plist for Saturdays and Sundays, yet the output the .plist is launched everyday.

The .plist

    <?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>RunAtLoad</key>
    <false/>
    <key>EnviromentVariables</key>
    <dict>
        <key>PATH</key>
        <string>/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:</string>
    </dict>
    <key>Label</key>
    <string>com.test.restartschedule</string>
    <key>ProgramArguments</key>
    <array>
        <string>/sbin/shutdown</string>
        <string>-r</string>
        <string>now</string>
    </array>
    <key>StartCalendarInterval</key>
    <array>
        <dict>
            <key>Hour</key>
            <integer>23</integer>
            <key>Minute</key>
            <integer>35</integer>
            <key>WeekDay</key>
            <integer>6</integer> 
        </dict>
        <dict>
            <key>Hour</key>
            <integer>23</integer>
            <key>Minute</key>
            <integer>35</integer>
            <key>WeekDay</key>
            <integer>7</integer>
        </dict>
    </array>
    <key>StandardErrorPath</key>
    <string>/var/log/RestartScheduleError.log</string>
    <key>StandardOutPath</key>
    <string>/var/log/RestartSchedule.log</string>
</dict>
</plist>

Best Answer

As Ted Wrigley stated: "The key for specifying day of the week is Weekday, not WeekDay. Launchd may not recognize the capital-D keyword, and might be ignoring it."

After correcting the key, launchd is now not triggering everyday.