The Pramati Server Remote Shell
Remote Shell Motivation
Depending upon the startup method used, user may or may not have a server admin prompt available to control Pramati Server. If server is started using startup scripts like runserver.bat (runserver.sh for UNIX and SOLARIS OS) then, at the end of server startup user is presented with a prompt similar to
- j2eeadmin@<node-name>
Several useful commands like list, deploy, trace load/unload, status all can be executed at this prompt. What if server is started in the back ground ? Like through admin service or as OS service. You can use remote shell in that case.
Remote shell allows one to connect to a running instance of server and provides prompt similar to j2eeadmin@<node-name> prompt where server can be controlled (remotely). Commands that can be executed at the j2eeadmin@<node-name> prompt can also be executed at the remote shell prompt.
How to connect:
To connect to a running instance of server using remote shell:
- Navigate to <server-install>/server/bin directory on a command propmt
- Execute remoteshell.bat (./remoteshell.sh for UNIX and SOLARIS)
- The script execution shall halt at a prompt
not_connected:>
- type “connect” (without quotes) and press enter to start the connection process.
- Enter the values of IP and naming (RMI) port for the server you intend to connect to and admin username/password when prompted for. A sample is given below
not_connected:> -ip [localhost]#192.168.1.2
not_connected:> -port [9191]#9191
not_connected:> -realm [system]#system
not_connected:> -user [root]#root
not_connected:> -password #
Attempting to connect to remote server instance…Please wait
Connected to [192.168.1.2:9191] as [root@system]
- Note that the password characters shall not be prompted on the screen as you type, for security reasons.
- You will be left at a prompt as given below (depending on the node -name)
j2eeadmin@default> [Remotely Connected]
- Now, at this prompt, you can execute commands like the usual j2eeadmin@<node-name> prompt.
In case you are trying to connect to a running node on the same machine, you can use a more user friendly command, after navigating to <server-install>/server/bin directory
remoteshell.bat -node <node-name>
(./remoteshell.sh -node <node-name> for UNIX and SOLARIS)
This command shall use the port numbers as configured in the <node-name> node’s server-config.xml file and connect to the running instance of node on these ports.
Once you are done, just execute the command “exit” without the quotes to come out of remote shell.
Uses of remote shell:
- Connect to a server running in the back ground on the same mcahine
- Connect to a remote server and remotely administer the same
- If the original j2eeadmin@<node-name> prompt becomes unresponsive you can use the remote shell prompt to collect desired debug info or to collect the status of server.
- You can also use it to shut down the server gracefully if original command prompt becomes unresponsive
- You can use remote shell scripting abilities to execute commands non interactively to complete any routine activities on server like application redeployment (Read further for details)
Scripting with remote shell:
Remote shell command can be used along with specific arguments to execute repetitive tasks like application redeployment on running instance of a server. After navigating to <server-install>/server/bin directory, one can execute:
remoteshell.bat -node <node-name> -cmd deploy <path-to-application-archive>
(./remoteshell.sh -node <node-name> -cmd deploy <path-to-application-archive> for UNIX and SOLARIS OS)
to deploy/redeploy the application the running <node-name> node. Due to its simplicity the same can be use in a batch or script file for repetitive invocation if desired. Commands like list, “status all” and shutdown too can be executed in this manner.

If you enjoyed this post, please consider to leave a comment or subscribe to the feed and get future articles delivered to your feed reader.

Comments
No comments yet.
Leave a comment