Skip to main content
Question

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

  • May 5, 2020
  • 3 replies
  • 33 views

Forum|alt.badge.img+4

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

DBrowning
Forum|alt.badge.img+25
  • Esteemed Contributor
  • May 5, 2020

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
Forum|alt.badge.img+25
  • Jamf Heroes
  • May 5, 2020

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


Forum|alt.badge.img+20
  • Honored Contributor
  • May 5, 2020

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