/system/cmd-json.php

Description
Includes
include_once ('../lib/Json.php') (line 27)

Provides a JSON interface for running arbitrary commands.

Provides a JSON interface for running arbitrary commands. This code allows one to run an arbitrary command on the NST probe (passed as the "cmd" parameter) and get the results back to a AJAX handler.

<dl> <dt>op=lines&cmd=CMD</dt> <dd>Returns results of running the CMD as a JavaScript object.</dd> <dt>op=sudo-lines&cmd=CMD</dt> <dd>Returns results of running "sudo CMD" as a JavaScript object.</dd> <dt>op=exec-dir&dir=DIR&match=PATTERN&args=ARGS</dt> <dd>Runs each executable matching PATTERN in DIR passing each invocation ARGS.</dd> </dl>

Functions
cmdArrayOutput (line 42)

Returns results of arbitrary command as a standard results object.

Returns results of arbitrary command as a standard results object. This method returns the associative array of the following form:

<dl> <dt>command</dt><dd>The original command which was run.</dd> <dt>rc</dt><dd>The integer return code from running the command.</dd> <dt>output</dt><dd>Array of lines (if command generated any output).</dd> </dl>

  • return: JSON ecoded string (an associative JavaScript array).
A cmdArrayOutput ( $json,  $tdir)
  • $json
  • $tdir

Documentation generated on Mon, 10 Sep 2012 09:57:12 -0400 by phpDocumentor 1.4.4