Hi PiGeon,
I'm experiencing the same problem, trying to remotely backup other routeros devices from my routeros router.
The exit-code is always 0, whatever happens during remote script execution, and the output only gives part of the remote commands console output when executed from a local terminal.
E.g.
prints the following in local terminal:
Saving system configuration
Configuration backup saved
whereas the remote script returns the following:
exit-code=0;output=Configuration backup saved\n
(and the \n doesn't print well using /log info)
It might be that the 2 above messages are not ouput on the same interface (stdout vs. stderr for instance).
Whatever, I'm currently thinking of a workaround that includes making sure that all the requested scripts issue a status message to console right before leaving, such as
:put "Success" or :put "Failure: $errorMessage"
Using the last ssh-exec output line will then allow to get reasonably appropriate feedback on remote script execution.
Obviously, the script needs to handle errors so that the status message is issued in all cases (although the lack of it could be interpreted as error).
Will keep you posted on progress.
Nicolas