157
www.analogway.com
USER MANUAL
USER MANUAL
USER MANUAL
USER MANUAL
USER MANUAL
USER MANUAL
USER MANUAL
USER MANUAL
D.g.
system and system_bg
These commands execute arbitrary command as Linux shell command. Difference between system and
system_bg is that system blocks while the command is running and then gives all of the command output in
one message. system_bg on the other hand runs the command on background sending one MSG for each
line the command outputs as it is available.
These commands send
CMD_SYSTEM_RESULTS
message once the command is complete and
CMD_SYSTEM_LINE_RESULTS
for each output line.
CMD_SYSTEM_RESULTS
has following fields that can be in any order:
-
stdout
Complete output from standard output
-
stderr
Complete output from standard error output
-
exit_code
Command exit code. 0 usually means success and any other value some kind of error.
This depends on the command being run.
-
id
Unique id for this system call. Used to identify possibly overlapping output from multiple
system_bg calls.
-
error
Error description in case of bad system call.
-
success
yes/no depending on whether the call succeeded.
None of the fields are mandatory except for success and that either error or
exit_code
must be given.
All strings have ’"’ and ’
’ escaped and linefeed replaced with ’n’.
CMD_SYSTEM_LINE_RESULTS
has only fields id, stdout and stderr. They behave like in
CMD_SYSTEM_RESULTS
. Id field is mandatory.
Both system calls have following structure in sending messages:
-
Send CMD_SYSTEM_LINE_RESULTS to define id
-
Run the command and send CMD_SYSTEM_LINE_RESULTS for each line the command outputs
-
Send CMD_SYSTEM_RESULTS when the command completes
Example:
10.0.0.1 # loglevel none
10.0.0.1 # receiving all
10.0.0.1 # system ls /picturall/media/bbb
MSG(100001, 0, 38, id=3)
MSG(100001, 0, 38, id=3, stdout="bbb_sunflower_2160p_60fps_normal.mp4\n")
MSG(100001, 0, 38, id=3, stdout="bbb_sunflower_2160p_60fps_normal.mp4.thumb\n")
MSG(100001, 0, 33, success="yes", id=3, stdout="bbb_sunflower_2160p_60fps_normal.mp4\n
bbb_sunflower_2160p_60fps_normal.mp4.thumb\n", stderr="", exit_code=0)
Line wrapping has been changed in the example to increase readability.