Can someone see any obvious reason my plist isn't trigger scripts correctly?

lukasindre
New Contributor III

I have this .plist called update.plist and I wan't it to trigger a shell script called weekly_update_trigger.sh every minute (changing to weekly after testing) and this is what the plist looks like:

<?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>update</string>
        <key>ProgramArguments</key>
        <array>
                <string>sudo</string>
                <string>sh</string>
                <string>/Library/JamfScripts/weekly_update_trigger.sh</string>
        </array>
        <key>StartInterval</key>
        <integer>60</integer>
</dict>
</plist>

Is there something obvious that I'm missing or that I should be looking for? The script isn't triggering, however when i run the script locally, it works.

The script is as such

#!/bin/bash
sudo /usr/local/bin/jamf policy -trigger weeklyupdate
exit 0
3 REPLIES 3

DBrowning
Valued Contributor

Have you tried removing the <string>sudo</string> line from the plist and the sudo from your script?
Also what are the permissions on each file?

sdagley
Honored Contributor II

Here are some handy resources when it comes to LaunchAgents and LaunchDaemons...

Pretty much everything you need to know about creating them: A launchd Tutorial

A great tool for creating, and troubleshooting, them: LaunchControl - The launchd GUI

Tribruin
Contributor III
Contributor III

Are you trying to run this as a LaunchAgent or LaunchDaemon? Since you need to run this as an administrator, you can remove the sudo part and just run this as a LaunchDaemon. Also make sure your plist has the proper permissions chown root:wheel /path/to/plist and chmod 644 /path/to/plist