Skip to main content
Question

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


N30
Forum|alt.badge.img+4
  • Contributor
  • 13 replies

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?

 

 

6 replies

Forum|alt.badge.img+3
  • New Contributor
  • 7 replies
  • April 18, 2022

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?


Forum|alt.badge.img+6

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


Forum|alt.badge.img+19
  • Honored Contributor
  • 582 replies
  • April 18, 2022

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

1-InstallTeamViewer

2-ActivateTeamViewer

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

 


dlondon
Forum|alt.badge.img+14
  • Honored Contributor
  • 374 replies
  • April 19, 2022

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


YanW
Forum|alt.badge.img+11
  • Contributor
  • 180 replies
  • April 19, 2022

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.

 

 


N30
Forum|alt.badge.img+4
  • Author
  • Contributor
  • 13 replies
  • May 15, 2022
dlondon wrote:

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


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


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings