Skip to main content
Question

Script not running via JAMF - runs locally just fine

  • June 6, 2019
  • 2 replies
  • 13 views

Forum|alt.badge.img+1

Hello, we are trying to run the below script via JAMF and it works fine using the Terminal locally, but the desired result (mounting a network share via DLC) sometimes works and sometimes does not.

sudo launchctl unload /System/Library/LaunchDaemons/com.apple.xsan.plist
sudo launchctl load -w -F /System/Library/LaunchDaemons/com.apple.xsan.plist

When it fails, we don't see any errors in the policy log in JAMF. Any suggestions on how to troubleshoot?

Thanks!

2 replies

Forum|alt.badge.img+8
  • Valued Contributor
  • June 6, 2019

What version of MacOS?
In Mojave I believe launchctl load will not run and agent until a reboot, so I have used launchctl boostrap in my online jamf scripts and it has been working fine.


Forum|alt.badge.img+19
  • Contributor
  • June 6, 2019

Don't include sudo in any scripts you put in Jamf Pro, it is not necessary as they always run as root.

What happens when the script in Jamf Pro looks like this:

#!/bin/bash

/bin/launchctl unload /System/Library/LaunchDaemons/com.apple.xsan.plist
/bin/launchctl load -w /System/Library/LaunchDaemons/com.apple.xsan.plist