User-defined commands can be implemented in Javascript - each command is implemented
by a Javascript function. The commands may be accessed as SITE commands in FTP/FTPS, and
as regular commands in SSH terminal. They may also be invoked via HTTP/HTTPS
(if enabled as a web feature) using a
URL of the format shown below, and the result is returned in JSON format.
http://hostname/CustomCommand/commandName?arg1=val1
The following function defines a command called 'Hello' which takes one argument:
function Hello(who)
{
return 'Hello ' + who;
}
All arguments are strings.
Commands added in this way are available to all users, who have permission for the 'CustomCommandScript' extension. These permissions may be modified in the Permissions tab of the Extensions panel.
.NET objects may be instantiated using the 'new' keyword, followed by the fully qualified name, e.g.
function Hello(who)
{
var b = new System.Text.StringBuilder();
b.Append('Hello').Append(' ').Append(who);
return b.ToString();
}
Static methods and properties of .NET objects may be accessed using their fully qualified name, e.g.
function HostName()
{
return System.Environment.MachineName;
}
To add JSS custom commands extension:
function Hello(who)
{
var b = new System.Text.StringBuilder();
b.Append('Hello').Append(' ').Append(who);
return b.ToString();
}