the payload 'Files and Processes' --> 'Execute Command'

tcandela
Valued Contributor II

Is it possible to put 2 different commands in the 'execute command' section of the payload 'files and processes'?

I currently have an lpadmin -p ........ command in it and wanted to see if it was possible to also add an additional command such as jamf policy -trigger <triggername>

would i need to separate the two with a comma, semicolon ?

1 ACCEPTED SOLUTION

bvrooman
Valued Contributor

You can separate the commands with a semicolon, or use a script payload instead.

View solution in original post

4 REPLIES 4

bvrooman
Valued Contributor

You can separate the commands with a semicolon, or use a script payload instead.

davidacland
Honored Contributor II

You can use a && e.g:

ls /Users && ls /Library

bvrooman
Valued Contributor

@davidacland's answer is good if the second command is reliant on the first. For example:

mkdir ~/Desktop/test; cp /some/files ~/Desktop/test

might act strangely if there was a problem creating the directory, whereas

mkdir ~/Desktop/test && cp /some/files ~/Desktop/test

will only execute the second command if the first returns a zero exit status.

Even more fun, you can use "||" to run the second command only if the first one produces a failure (non-zero exit status).

tcandela
Valued Contributor II

basically this is what i want to have done via 'files and processes' --> 'execute command'

i know i can also do it in a script, i like to give both ways a shot

lpadmin -p MathLab_Xer4112_Rm200 -o printer-is-shared=false; jamf policy -trigger TESTXeroxDriverCustomEvent