More than one script in a task

Hi folks,

I’m trying to figure out how to run more than one script as part of an action/task. Action1 does the work of actually deploying the package shown below – all of our clients are Macs. I want to run a bash script after doing this, but if I click Add next to the script list and paste in a script for this, it only ever runs Action1 and there is no option to select more than one.

You can only run 1 action at a time from a Fixlet – and you’d only really ever want to run 1 action at a time. When you action the fixlet each action appears in the dropdown.

Technically you could make another action, make a baseline, and add both the actions from the fixlet. The issue with this is that you cant have separate relevance statements for each action so you’ll get weird behavior doing this.

Your best bet is to just add the script to the end of Action1. Write out the bash script using actionscript (or download the bash script) and then just run it within the same task.

My recommendation would be to add the script after the fact if it’s not part of your package. Edit the task like your screenshot suggests then add it into the Action1 ActionScript using the “createfile until” function.

createfile until THISISTHEEND
#!/bin/sh
echo Hello World!
THISISTHEEND

At this point, you have your script, line for line, created on the endpoint. Then you give it permission to execute and run it.

wait chmod +x {(client folder of current site as string) & "/__createfile"}
wait {(client folder of current site as string) & "/__createfile"}
1 Like

So this is what we’re trying to do:

  • Install MS Office 2016
  • Delete just Outlook 2011 from the /Applications folder.

That second step was what the script would be for. Is there a simpler way to do this?

Is Outlook already installed?

Yes. Outlook 2011 is installed; we’re trying to install Office 2016 and delete Outlook 2011 (which is part of Office 2011).

Are you able to uninstall Outlook 2011 using Control Panel’s “Add/Remove Programs”?

This is on a Mac. It’s in /Applications and there is no application manager like in Windows. You just delete the folder hierarchy.

1 Like

Sorry not a Mac guy.

If that’s the case, wouldn’t this work?

waithidden rm -rf /Applications/Outlook2011

That would be the action script equivalent for deleting the folder or at least the one I would use.

1 Like

You really just want to run multiple commands in the same action in a sense.

You can have multiple wait statements to do this.

You can use a create file actionscript to actually create the batch file dynamically in line with the actionscript so that you don’t have to upload and download the batch file. Using create file is faster and lets you iterate more easily.

Since this is just a simple single command that you are trying to run, then there is no reason to use a batch file at all. You can just run the command similarly to how @jmaple puts it.

That seems to have done the trick. Thanks jgstew.

1 Like