Sequence of event for a JSS Policy

Bernard_Huang
Contributor III

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?

1 ACCEPTED SOLUTION

DI_Casper
New Contributor II

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.

View solution in original post

5 REPLIES 5

DI_Casper
New Contributor II

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.

Bernard_Huang
Contributor III

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

Chris
Valued Contributor

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

SimonLovett
New Contributor III

@ 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).

Bernard_Huang
Contributor III

Thanks @DI_Casper ,

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