1

Imagine I have 3 or 4 Macs on a long bench.

(Assume same wifi network, whatever needed.)

In short, I want to do something on Mac1 which makes something run on Mac2, 3, and 4.

So, it will be running known app X and doing known function Y - and that's it.

Is there a standard sort of approach?

Fattie
  • 178
  • 1
  • 5
  • 25
  • Try ssh. Set it up so that no password is needed. – lhf Oct 27 '20 at 15:56
  • Wouldn't it be better to monitor the server (folder) for changes to the file rather than the iMac for an action? The action may occur, but that doesn't mean the file got updated. In that case, Mac 2 would begin to work but there would be nothing to work on. – Allan Oct 27 '20 at 16:19
  • I'm no expert user of it by any stretch of the imagination, but this sounds like something Apple Remote Desktop could do, from the Manage menu - https://i.stack.imgur.com/B0KHb.png – Tetsujin Oct 27 '20 at 16:30
  • There's no Applescript that will trigger a different Mac. If you want the Mac you're on to trigger a different Mac, you have to send it a command and the best way to do that is via ssh Example: ssh user@host 'echo Hello World' If you are updating files or a database, or whatever, you can use your scripting language to check to see when the file was last changed, if it exists, etc. The question itself is much too broad for an answer here, much less comments. You have to decide how you want the workflow to go and then figure out what method you want to determine when to trigger it. – Allan Oct 27 '20 at 16:46
  • You don't use a machine to trigger another machine, you have your machines (or services) look for something to exist (like a file on a central server) before it does something. Like I already said, triggering on an action is not safe because the action could fail half way through. – Allan Oct 27 '20 at 16:48
  • Are all your tasks known before hand – or are you looking to perform unique actions and have those replicated across all the machines? – Graham Miln Oct 27 '20 at 17:00
  • @GrahamMiln - yes – Fattie Oct 27 '20 at 17:06
  • "There's no Applescript that will trigger a different Mac" - thanks @Allan – Fattie Oct 27 '20 at 17:06
  • totally correct, @GrahamMiln . So, in app X do function Y, and that's it. – Fattie Oct 27 '20 at 17:28
  • Please can you add a specific example of a task. Without knowing the applications, tools, and tasks involved, this question is too broad to answer well. – Graham Miln Oct 28 '20 at 07:51

1 Answers1

3

There are a huge number of orchestration technologies out there from the trivial to the very complex (and expensive) running enterprise workloads across many other systems.

As per several of the comments, the easiest way would be to write 2 scripts:

  1. To run on Mac 1 that tells Macs 2, 3, and 4 to run your second script
  2. Runs your actual task, or, triggers and controls the app which runs your task.

The first script will run and connect via ssh, using pre-defined keys) and trigger the scripts.

It would help to have more details on the specific task you trying to run, but script 1 can be as trivial as:

#!/bin/bash

ssh user@mac2 'script2.sh' ssh user@mac3 'script2.sh' ssh user@mac4 'script2.sh'

and script 2 being something like:

#!/bin/bash

/run/some/app.app

Your original question was just "can you do this, and what's normal" - which is described above, so I don't want to go into a treatise on good scripting practice, especially without knowing your abilities and experience here.

There are also numerous answers on how to setup SSH keys for your Macs (eg. this ). In the above you'd need DNS to work, so maybe IPs would be simpler, and obviously user needs to exist as a user on the other macs, with the keys in place.

In recent macOS version zsh is the default not bash, but bash is there and functional as a scripting shell.

Alex
  • 9,600