How to call/run another script when finish running one script?

New Contributor III

Hi All,


I have a script that i use to mass deploy teamviewer host using Jamf.

The only problem with my script is that it sometimes do not do the account assignment and enrollment of teamviewer host (last lines of my script). 

I was thinking maybe i can set it up so that when my teamviewer policy finish run, Jamf can call/run another script that basically kick the last lines of code/teamviewer enrollment.


Does anyone be able to guide me on how to do this? How can i call another policy/script upon finish off running a policy/script?





New Contributor II

You could create a new script to call the Policies.

so you have 1 script to install your team view, called in it's own policy. 

then another script to run the teamviewer enrollment in it's own policy

set both of those as available in self service, 

then create a new script with it's own policy - this script first calls the install script policy, then it calls the teamviewer enrollment/user policy., once the previous script has returned an exit of 0


that's what I'd likely do in your scenario - likely others have a better method?

New Contributor III
New Contributor III

If you’re not using the “Files and Processes” payload, you can always provide a custom event trigger then use “Execute Command” field in the files and processes to call another policy using your custom trigger. Ie: 


1. Policy 1 runs with script

2. policy calls “sudo jamf policy -event customPolicyTrigger2” via the Files and Processes payloads.

3. Policy 2 runs with script 

4. policy calls “sudo jamf policy -event customPolicyTrigger3” via the Files and Processes payloads.

5. Etc etc

Valued Contributor II

All good suggestions. You can also just run two scripts in the same policy. Scripts run in alphabetical order. So name your scripts like:



Just to add security, make the install script a "Before" script and the activation an "After" script. 


Valued Contributor

Looking at this slightly differently - if you increase that sleep 60 to sleep 300 does it always work?

New Contributor III

still the same, increase it to 500 from 60seconds and still doesnt work

Contributor III

Your script looks similar to the last one in this POST, maybe try that one see if it works.

*Please post script by selecting "Insert/Edit code sample" option instead of picture. It's easier to read.