Skip to main content
Solved

Sequence of event for a JSS Policy

  • February 9, 2017
  • 5 replies
  • 18 views

Forum|alt.badge.img+10

Hi all,

I believe a script can only be run before or after some package runs. I have a sequence of event that I would like to do:

a) Copy some files (these files are required by step b)
b) run a install.sh script
c) install a pkg package
d) install another pkg package
e) run another sh script
f) delete the files from step a (This can be a script, so that's ok)

Step B is what I am stumped about. How can I copy some file in (files would be in DMG package), then run my script, then install some more pkgs?

Best answer by DI_Casper

I think the best thing is for you to create a policy for each then call the next policy.

For example, the first policy will be step a. In that policy make sure you configure "Files and Processes." Then, under execute command you would type "sudo jamf policy -id ID" (you would replace ID with the id number for step b policy. Then step b policy you would call step c and so on.

You will have to make sure that all the polices have the same scope.

5 replies

Forum|alt.badge.img+5
  • New Contributor
  • 7 replies
  • Answer
  • February 9, 2017

I think the best thing is for you to create a policy for each then call the next policy.

For example, the first policy will be step a. In that policy make sure you configure "Files and Processes." Then, under execute command you would type "sudo jamf policy -id ID" (you would replace ID with the id number for step b policy. Then step b policy you would call step c and so on.

You will have to make sure that all the polices have the same scope.


Forum|alt.badge.img+10
  • Author
  • Valued Contributor
  • 143 replies
  • February 9, 2017

Thanks @Di_Casper,

I'll try this tomorrow when I get back to the office.
Thinking ahead, can there be any error handling?
For example:
If Policy 1 failed
Don't go onto Policy 2


Forum|alt.badge.img+13
  • Valued Contributor
  • 268 replies
  • February 9, 2017

You could also look at Payload Free Package Creator
which makes it super easy to wrap your script into a pkg, which you can then insert into the workflow in the right place using priorities


Forum|alt.badge.img+7
  • Contributor
  • 35 replies
  • February 9, 2017

@ Bernard.Huang, you could error check stage a by creating a smart group to detect whether the files you copied have arrived safely, and use that smart group as the scope for stage b (and c, and d, and e in the same way if you wanted to separate them, however you can just chain all the install packages one after another in one policy also).


Forum|alt.badge.img+10
  • Author
  • Valued Contributor
  • 143 replies
  • February 13, 2017

Thanks @DI_Casper ,

The Files and Processes option really worked well for me. I can call the next step with the policy ID.