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?

10
  • Try ssh. Set it up so that no password is needed.
    – lhf
    Oct 27, 2020 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, 2020 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 - i.stack.imgur.com/B0KHb.png
    – Tetsujin
    Oct 27, 2020 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, 2020 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, 2020 at 16:48

1 Answer 1

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.

1
  • What a great answer - I guess you're right; treat them like any other unix box. Good one
    – Fattie
    Oct 28, 2020 at 12:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .