# nexec## 1 Description: nexec is a remote command interface engine
Nexec [-?] [-T term] [-O] [-I.] [-l] [-nohup hostname "CMD &"]-e | hostname cmd [args]
If you do not want to look at the following smelly and long, you can directly see the following example:
# # 2 Common examples of nexec
1 executing commands on the specified host
cloudexpress# nexec 10.200.108.92 NET user
2 command execution commands are executed on the host where the current path resides
cloudexpress# CD//10.200.108.92
10# pwd
10.200.108.92/c/
10# NEXEC-E Ifconfig
3 executing commands or programs in the background on the specified host (for situations where many environment variable dependencies are required)
cloudexpress# nexec-nohup 10.200.108.92 "ipconfig &"
4 Running the Script sample
On Windows:
Nexec 10.200.108.92 cmd/c "C:\startup.bat"
On Linux:
Nexec-u-L 10.200.108.92 su-root-c "sh/etc/startup.sh"
In fact, the above two examples are nexec
Nexec-u-l-nohup 10.200.108.92 su-root-c "Sh/etc/startup.sh &"
The example has been read, enough to go away
# 3 Description
Nexec has two ways of working
1 display Mode
Syntax: *nexec ARG1 arg2*
The first parameter can be the host of the command being executed, or-E, if it is-e means that the command is executed on the host where the current working directory resides. The second parameter is the parameter of the command and command to be executed remotely
Example: Nexec 10.200.108.92 tasklist/fi "IMAGENAME eq tasklist.exe" equivalent to CD//10.200.108.92;nexec 10.200.108.92 tasklist/fi "I Magename eq Tasklist.exe "
2 Implicit Way
The executed command is already soft-connected to nexec, and the command is executed implicitly. When executed, the system automatically interprets the command to be executed <command> interpreted as nexec
# # 4 Command parameters
- e executes commands on the current remote host
-I notifies the agent to run in pure interactive mode for some programs that need to interact (such as Solaris/bin/vi or Aix's Smit). If you use this option, both standard output and standard error messages will be displayed together. Without this option, remote standard output and standard errors will be written to their local standard output and standard errors. Use this option only if the remote computer's interactive program is not displayed properly.
- L simulates a login shell. This option attempts to start a remote program to impersonate the actual logon session. It sets the value of the home, LOGNAME, and user environment variables based on remote permissions. It sets the initial working directory to a valid remote user's home directory. The *cmd args* is then invoked with the default shell of a valid remote user, and the *argv[0]* is "-" set for the execution program (the default shell for the active remote user). This is a method that is understood by various shells (such as sh,ksh,bash, etc.) to indicate that the current shell is the login shell and executes the initialization script (such as. Profile, etc.) in the form of the login shell. Ultimately, this option creates a record in the *utmp* database. Records of the UTMP database can be viewed through the *who* command.
Note: This option applies only to remote servers that are UNIX-like machines, and not all platforms support *utmp*. If *cmd* is executed by the default shell of a valid remote user, then nexec executes the command directly instead of deriving the new shell again.
The following example illustrates how a command executes (assuming the default shell is/bin/ksh).
Client sends ' nexec-l-e Ls-la '
Agent executes '/bin/ksh-ksh-c "Ls-la"
Client sends ' nexec-l-e Ksh '
Agent executes '/bin/ksh-ksh '
- n ignores standard input (no data is read from the standard input). By default, nexec will send all input data to the remote command as standard input. With this option, standard input is no longer read, so this option is used only for commands that do not require input.
-nohup Hostname "CMD &"
Executes a command in the background of the server, which is available for Agents 7.0.3 and later.
- o uses the old version of the Nexec protocol. Release7.0 introduced some synchronization patches for the NEXEC protocol, using this option to tell nexec not to use these synchronization patches.
- R does not automatically transcode Input/output, see section (Internationalization issues) for more information.
- u Use this option nexec to convert the output (STDOUT/STDERR) of all commands from the local code page of the destination server to UTF8. It assumes that the output is composed of the correct code page sequence, so the random binary number may not be converted correctly, and the invalid and/or unrecognized sequence will be converted to a question mark '? '.
- T term tells Nexec to ignore the value of *term variable* and use *term* instead of the terminal type.
When the **nexec** command is executed on a Windows machine, the command cannot be an interactive command, and must be a batch (output only).
# 5 Internationalization Issues
One problem is how these machines interact meaningfully in a mixed code page environment when the user executes across multiple servers.
For example: A window server is set to the area of Japanese, code page is CP932, and another Solaris server is set to Japanese, but the code page is EUC-JP. The Japanese output is generated by executing commands on the Solaris machine from the Windows machine via Nexec. The output displayed on the Windows machine is wrong because the Windows machine expects the CP932 code sequence, but Solaris provides a EUC-JP code sequence. So the result of the output may not be very useful.
To address this problem, nexec now automatically transcode by default. The output of the command is normally converted to a local code page in the Nexec client and then displayed to the terminal/screen. Now the output of the command is fetched by the agent and automatically converted to UTF-8, and then sent to the Nexec client, which is eventually displayed on the terminal. Similarly, the input of the nexec fetch (stdin) is also converted to UTF-8 before being sent to the agent.
Since this automatic transcoding may not always be sufficient, using the-r option makes all data in raw mode, that is, no automatic transcoding.
Note that there is a transcoding problem, and the unrecognized character is subject to the question mark '? ' Alternative. If you do not want to transcode automatically, you can disable this feature by using the *-r* (raw) option.
# # 6 X11 Forwarding
The Nexec tool automatically configures the agent to fetch X11 traffic in the following ways:
Resets the **display** variable and forwards traffic to the server that originated the nexec call by tunneling. This allows you to safely forward X11 traffic through the tunnel, which is the same as other NSH tool security features.
# # 7 NEXEC Commands supported by default
The Network shell provides the following pre-configured commands:
ARP, finger, ifconfig, ipconfig (NT), MEM (NT), Mount, nbtstat (NT), net (NT), netstat, nfsstat, PS, size, swap, umount, uptime, Who, Xterm
# 8 Warning
commands from different operating systems may be inconsistent, and one parameter option may not be uniform on different platforms. For example, the *ps* command, in the BSD, ATT system parameter options are completely different. Of course, some commands may not be available on some hosts.
Because the nexec command does not support graphical interface interaction, the Windows platform supports only simple input and output commands/programs, and programs that require console interface operations hang or function abnormally.
# 9 Author
Nexec was written by Thomas Kraus.
BSA Nshell Series-nexec command