Open/Activate an closed Application on a remote machine through pssh in Mac os10.12.6

209 views Asked by At

I was trying to open an application remotely using below command, but I get an error

pssh -h node.txt -O StrictHostKeyChecking=no -l mapsadmin -i "open /Applications/FusionX.app"

Below is error:

Stderr: LSOpenURLsWithRole() failed with error -10810 for the file /Applications/FusionX.app

mapsadmin is the user with root privileges, still couldn't get luck. Please help me in solving this.

I have tried with AppleScript also, but no luck

pssh -h node.txt -O StrictHostKeyChecking=no -l mapsadmin -i "osascript -e 'tell application \"FusionX\" to activate'"
[1] 16:07:31 [FAILURE] <IP address> Exited with error code 1
Stderr: 30:38: execution error: An error of type -10810 has occurred. (-10810)

Help me in solving this. Is there anything else to be enabled on remote machine to let this happen?

1

There are 1 answers

0
CJK On

I would have preferred to leave this as a comment, but it was too long. However, I fear this may not be a complete answer, as the causes of the error are myriad, but I hope this might help.

First, ssh into your remote machine using the standard ssh command (or go to the machine physically and open Terminal). Now see if are you able to run the application from there using open /Applications/FusionX.app. If this throws the same error, then see if you can run the actual binary file located in /Applications/FusionX.app/Contents/MacOS

cd /Applications/FusionX.app/Contents/MacOS
./FusionX

(Assuming the binary file located in that folder is called FusionX. If not, adjust the line above accordingly.)

If that doesn't run the application, run this command:

chmod +x ./FusionX

then attempt to run the binary again. If that works, exit from secure shell or return to your local machine and attempt to run your pssh command again. I'm hoping this might solve your issue.

Also, you could try pure AppleScript to launch the application remotely using a command like

tell application "FusionX" of machine "eppc://remote_ip_or_hostname" to activate

(This requires Remote Apple Events turned On on the remote machine (under System Preferences > Sharing) and assumes FusionX is Apple-scriptable.)

Obviously, the limitation here is having to specify this command for each remote machine individually rather than through a single parallel command targetting multiple hosts.