Skip to main content
Solved

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

  • February 23, 2015
  • 4 replies
  • 106 views

Forum|alt.badge.img+20

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 ?

Best answer by bvrooman

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

4 replies

Forum|alt.badge.img+16
  • Valued Contributor
  • Answer
  • February 23, 2015

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


davidacland
Forum|alt.badge.img+18
  • Valued Contributor
  • February 23, 2015

You can use a && e.g:

ls /Users && ls /Library

Forum|alt.badge.img+16
  • Valued Contributor
  • February 23, 2015

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


Forum|alt.badge.img+20
  • Author
  • Contributor
  • February 23, 2015

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