I face a vexing problem on my home set-up involving a Server mac advising a Client mac that a task (a back-up task) was successfully implemented. The purpose of this instruction is to trigger (through the Client mac automation software) the shut down of the backup disk power supply, to save energy. Both macs are running high Sierra and the Client mac must run the following applescript upon receipt of the appropriate instruction from Server (xtension.app is a home automation software having applescript interface but no shell script interface).
Tell application "xTension" execute script "TurnOffD2" end Tell
The above applescript, located in any directory of the Client mac, works when addressed manually and locally: I can trigger it (1) locally on the Client mac by hand on the applescript or (2) it works by a local manual command to a shell script located in a directory of the same Client mac the job of which being to trigger the applescript or (3) by the below line of command in terminal ("shellScript") .
To trigger the applescript from the Server mac (away from the Client mac), I have first tested a ssh shell script having root privileges on both machines
ssh -i /var/root/.ssh/jxxxxxx_rsa root@iMacdexTension.local
This script works when requested to execute simple tasks on the Client mac (like listing files seen in a directory), but fails when used to trigger the applescript above, directly using osascript or indirectly.
Example: any attempt to indirectly trigger the applescript through a shell script command fails.
ssh -i /var/root/.ssh/jxxxxxx_rsa root@iMacdexTension.local /path_to_shellScript/shellScript
ERROR MESSAGE ON FAILURE It fails with the error code : "execution error: An error of type -10829 has occurred. (-10829)
Second example: any attempt to directly trigger the applescript also fails.
ssh -i /var/root/.ssh/jxxxxxx_rsa root@iMacdexTension.local osascript /path_to_apple_script/apple_script
MY ATTEMPTS TO CORRECT
I have verified permissions on files and directories (tried different combinations as well)
I also have tried to correct possible privilege issues and, to do that, tried to use the recommended shell commmand
password "pswd" with administrator privileges
Whatever I do, the best I can get is the -10829 error message..
What could I do wrong ?
Thanks in advance for any suggestion or doubt.