6.4.4 Method for specifying scripts
You can set a script for each OS to create plug-ins that match the OS on the operation target device. You can define a script or command that exists and can be executed on the operation target device.
You can re-register the script file that has already been registered. The existing file is overwritten when the file is re-registered.
Difference between the methods for specifying scripts
You can specify a script by attaching a script file that has been created, or by directly entering the script. The differences between these two methods is described below.
- When Attachment is selected:
If you use zip format, you can register a script composed of multiple files or multiple folders.
Note that compressed files with zip extension are renamed when you save plug-ins in the JP1/AO server. The file name is changed to windows.zip or linux.zip, depending on the OS. You can download the file you registered by selecting Attachment, to the terminal on which you perform JP1/AO operations via a Web browser. If you directly enter a script, you cannot download the script file you defined.
- When Type in is selected:
In the Edit Remote Command dialog box, directly enter the content of the script you want to execute on the operation target device. You can define a script or command that exists and can be executed on the operation target device. In this case, you can define only one script file. The character set and linefeed code for the script to be saved are fixed depending on the OS on the operation target device.
Therefore, if you want to register a script file composed of multiple files or if you want to set any character set and linefeed code you want, select Attachment.
The following table describes the differences in character sets and linefeed codes that are set and how to register files, between the settings for Script specification method.
Item |
When Attachment is selected |
When Type in is selected |
||
---|---|---|---|---|
Windows |
Linux |
Windows |
Linux |
|
Registration of a file |
Can be registered. |
Can be registered. |
||
Registration of multiple files |
Can be registered. |
Cannot be registered. |
||
Character set for the script to be saved |
The character set for the registration file is set. |
The default character set for the OS on the JP1/AO server |
UTF-8 |
|
Linefeed code for the script to be saved |
The linefeed code for the registration file is set. |
CR+LF |
LF |
Notes on creating script files
Note the following when you create a script file:
Use ASCII characters for a script file. You cannot use the following characters:
Control characters ('\u0000' to '\u001F', or '\u007F' to '\u009F')
Question marks (?), asterisks (*), double quotation marks ("), right angle brackets (>), left angle brackets (<), vertical bars (|), and colons (:)
You cannot use multi-byte characters for file path and file name.
The scripts executed in plug-ins can have return values in the range from 0 to 63.
Plug-ins and service templates must be designed in such a way that standard output and standard error output produce less than 100 KB of data. When the standard output or standard error output of a plug-in exceeds 100 KB, the script is immediately stopped and the plug-in terminates with an error. In this scenario, the results of execution of the script cannot be guaranteed.
The locale used when a script is executed differs, depending on the OS on the operation target device. For details about the locale set for the operation target device, see 6.1.6 Locale set for operation target devices during plug-in execution.
-
Interactive commands and script that seek user input and commands that do not end automatically using a GUI display or the like cannot be executed.
- If you connect to the execution target server with protocol SSH and the general command plug-in outputs KNAE08107-E and fails, the command that the specified in a general command plug-in may clear the standard input.
In that case, identify the command that is clearing the standard input and prevent clearing the standard input.
An example of how to prevent clearing of standard input is to specify < /dev/null in the command.
- Tip
For details about the setting of return values when a command or script is executed, see 6.4.9 Return values of content plug-ins.