One Policy Multiple Commands

easyedc
Valued Contributor II

Any one ever tried to execute more than one unix command in a single policy? We have a self service policy to update inventory. I'd like it to run both a JAMF Manage & JAMF Policy at the same time. Right now, I think I can only run 1 of those commands. Am I wrong? I know I could do this via script, however, that would require touching every policy that I need to force that against.

Sorry if I'm re-asking something from the past, but I couldn't find a quick answer.

3 ACCEPTED SOLUTIONS

mm2270
Legendary Contributor III

I assume you;re referring to the Run Command field, or whatever its called now in version 9, If so, just put a semi colon between the commands, like this-

jamf manage; jamf policy -trigger <sometrigger>

It will run the first command to completion, then run the second one.

View solution in original post

tlarkin
Honored Contributor

Hi @easyedc

If you are referring to the advanced run command field in a policy, you can have it run multiple commands by separating them with a semicolon. For example:

echo "Hello" ; echo "world"

I do, however, want to ask you the higher goal of this. Running a lot of manage and recon commands could have ill-effects on the database. So, if I could get a better idea of the workflow you are wanting with the end goals I could maybe give better, or at least more options to help you reach those.

Thanks,
Tom

View solution in original post

nkalister
Valued Contributor

this post was a brain burp, ignore me!

View solution in original post

7 REPLIES 7

CasperSally
Valued Contributor II

You can put both commands you want in a script and have the policy run the script.

mm2270
Legendary Contributor III

I assume you;re referring to the Run Command field, or whatever its called now in version 9, If so, just put a semi colon between the commands, like this-

jamf manage; jamf policy -trigger <sometrigger>

It will run the first command to completion, then run the second one.

easyedc
Valued Contributor II

Again... Was hoping to not write a script to do that, but will if I must. In the future I imagine that this would expand in the future than just running simple JAMF tasks.

tlarkin
Honored Contributor

Hi @easyedc

If you are referring to the advanced run command field in a policy, you can have it run multiple commands by separating them with a semicolon. For example:

echo "Hello" ; echo "world"

I do, however, want to ask you the higher goal of this. Running a lot of manage and recon commands could have ill-effects on the database. So, if I could get a better idea of the workflow you are wanting with the end goals I could maybe give better, or at least more options to help you reach those.

Thanks,
Tom

nkalister
Valued Contributor

this post was a brain burp, ignore me!

easyedc
Valued Contributor II

It really is for a simple policy that generally are run just by the admins to make sure that it's inventoried, has had it's policies run, and all management structures run. it's only run via self service instead of a recurring.

mike_paul
Contributor III
Contributor III

A 'jamf policy' will also run a 'jamf manage' automatically if there is anything different in the management framework in the JSS vs whats set on the machine. You can confirm this by making a change in the Computer Management Framework and then run a 'jamf policy' via terminal, you should see it updating management as well. Out of curiosity, what specifically are you trying to accomplish with a 'manage' command? Its not a bad thing to run since it can remedy issues but I am just curious if you are trying to remedy something else that we can help with.