The error message is at least consistent with a failed attempt to run a command directly through
ssh someuser@somehost somecommand.
Depending on how
zsh is started and in which configuration file you put the alias by the app it is possible that it was just not loaded. Also, the history file will only be written by interactive sessions (which is a "Good Thing™": imagine if every zsh script would dump its content into your history file on execution).
osascript is the command line AppleScript interpreter (thanks to forquare for the hint). As such it is not available for Ubuntu. But it is likely that the app is running some small script via command line parameter to shut down the Mac.
If shutting down your machine is the only thing you want to do, you could just place some script in
/usr/bin/osascript on your Ubuntu machine that shuts it down. For example:
sudo /sbin/shutdown -h now
This assumes password-less access to at least
shutdown -h now. You can achieve that by adding the following line to your
/etc/sudoers or a file that is included by it:
YOURUSERNAME ALL = NOPASSWD: /sbin/shutdown -h now
If you want to react to different commands (shutdown, reboot, etc.), you can try to to retrieve the command line parameters which the app uses for them. For that first place the following script with the name
/usr/bin (In theory any path listed in
PATH should do. Unfortunately
ssh often uses its own settings for
PATH. See below.) on your Ubuntu machine:
echo "$@" >> "$logfile"
echo '---->8----' >> "$logfile"
Do not forget to make it executable (
chmod 755 /usr/bin/osascript).
Now you can run through the different options the app has to offer and check the output in the logfile each time (
tail -F /path/to/logfile might help). Now you only need to find the differences in each output and write a script that reacts accordingly.
As mentioned above,
ssh may use its own settings for
PATH, which might be quite different from the settings you get in your terminal session (
echo $PATH). Luckily you can easily retrieve the
PATH used by
ssh localhost 'echo $PATH'
If you see
/usr/local/bin in there, I suggest placing the script there, but any listed directory should do.