Posted on 03-13-2016 10:58 PM
I’m trying to get a post-install script to run from a custom trigger. This seems like it should be fairly straight forward so I assume I’m overlooking something quite basic? And yes, I am a noob in terms of scripting so please go easy on me. Or not! I just can't figure out what I'm doing wrong...
Following a suggested imaging Workflow on Macmule I’ve created postflight.sh like this:
#!/bin/bash
jamf policy -event postflightconfig
Which has then been set to run at reboot as part of this imaging config:
With the policy itself set to trigger at a custom event defined as postflightconfig, like this:
Except nothing happens?
If I make postflight.sh executable I can run it manually and the policy is successfully triggered so I know the trigger and policy are OK. I just can’t get it to run at reboot after imaging?
JSS is 9.81
Thanks in advance...
Solved! Go to Solution.
Posted on 03-14-2016 07:56 PM
Solved with help from @CasperSally's post here
Posted on 03-14-2016 02:58 AM
It all looks correct to me.
The problem sounds like the Casper imaging process isn't triggering the script.
I would take a look at the casper imaging log for a device you've tested it on, and/or look in the /var/log/jamf.log file on the client to see if there are any clues.
Posted on 03-14-2016 06:17 AM
I'm not sure the environment variables in your setup. You might want to use the full path to the JAMF binary
/usr/local/jamf/bin/jamf policy -event postflightconfig
Posted on 03-14-2016 06:29 AM
Any difference between
/usr/local/jamf/bin/jamf
and
/usr/local/bin/jamf
?
Posted on 03-14-2016 06:34 AM
/usr/local/bin/jamf is a symlink (alias) that points to /usr/local/jamf/bin/jamf. The former is likely safer in long term scripts. The latter is the real binary.
Posted on 03-14-2016 06:42 PM
Log shows the policy being triggered but it's unable to connect to the JSS? Looking at the sequence the custom event runs before any of the JAMF items. Do I need to alter the sequence so that it runs after default JAMF management stuff has been applied? If so how do I do that exactly?
2016-3-15 10:37:58 Formatted Macintosh HD
Tue Mar 15 10:37:59 NetBoot018 jamf[881]: Installing create_ladmin_1.1.pkg...
Tue Mar 15 10:38:00 NetBoot018 jamf[881]: Successfully installed create_ladmin_1.1.pkg.
Tue Mar 15 10:38:02 NetBoot018 jamf[946]: Creating .AppleSetupDone...
Tue Mar 15 10:39:32 MBA jamf[201]: Checking for policies triggered by "postflightconfig"...
Tue Mar 15 10:39:34 MBA jamf[201]: Could not connect to the JSS. Looking for cached policies...
Tue Mar 15 10:39:49 MBA jamf[300]: Creating user casper...
Tue Mar 15 10:40:19 MBA jamf[300]: Enforcing management framework...
Tue Mar 15 10:40:25 MBA jamf[300]: Enforcing scheduled tasks...
Tue Mar 15 10:40:25 MBA jamf[300]: Adding launchd task com.jamfsoftware.task.1...
Tue Mar 15 10:40:26 MBA jamf[300]: Creating launch daemon...
Tue Mar 15 10:40:26 MBA jamf[300]: Downloading the agent...
Tue Mar 15 10:40:26 MBA jamf[300]: Creating launch agent...
Tue Mar 15 10:40:27 MBA jamf[746]: Informing the JSS about login for user _mbsetupuser
Tue Mar 15 10:40:29 MBA jamf[756]: Checking for policies triggered by "enrollmentComplete"...
Tue Mar 15 10:40:32 MBA jamf[756]: Upgrading JAMF notification service...
Tue Mar 15 10:40:33 MBA jamf[756]: Upgrading Self Service.app...
Tue Mar 15 10:40:33 MBA jamf[746]: Informing the JSS about login for user ladmin
Tue Mar 15 10:40:41 MBA jamf[952]: Checking for policies triggered by "startup"...
Thanks again..
Posted on 03-14-2016 07:56 PM
Solved with help from @CasperSally's post here
Posted on 03-15-2016 04:38 AM
@loftus glad it helped someone!