Call legato app from sh; returning/echoing values

Hi there,

this seems to be so simple, I must oversee something.

I want to echo some information from an app and call this app from the command line.
What I mean:
If I call “date” in my shell, I receive the current date and time because the application that’s called by “date” prints it to the command line
If I call “app start myApp”, I got… silence. printf and LE_INFO are redirected to a logfile, I receive no output at all.

How can I print the output of my application to the command line (preferably without any other overhead messages like “Starting Legato App blablabla”)?

My goal is to call my app using a cgi script and process the output of the app.

Thank you and best regards

Frank

You might have a look on the cm tool as it can print message to command line.

Thanks, that helped.

My issue was that my app was sandboxed. In this case you cannot call it from a script (at least didn’t work for me), unsandboxing helped; app will be found in /legato/systems/current/apps//read-only/bin. This can than be called from a script.

Don’t forget to call exit(EXIT_SUCCESS) to avoid error messages to flow into your command result.

Path to the CM script that you know from your command line: https://github.com/legatoproject/legato-af/tree/master/apps/tools/scripts