HomeDocumentation > User's guide > GShell

GShell is an extensible, command-line processing environment for creating command-line applications. GShell includes support for command editing, command history, input/output redirection, and more. GShell is a subproject of Geronimo. For more information on GShell, see the GShell wiki.

Many Geronimo administrative commands have been implemented using GShell. Previously existing Geronimo commands (e.g. startup, geronimo.sh, deploy.sh) are still included in Geronimo. Over time, however, it is expected that we will implement all administrative commands using GShell, only.

This document is organized in the following sections:

Running GShell

A simple launcher script/.bat file is located in the <geronimo_home>/bin directory. To start GShell just type gsh

GShell commands may be specified when starting GShell:

./gsh deploy/list-modules

or commands may be entered interactively:

coltrane kevan$ ./gsh
Apache Geronimo (2.1)

Type 'help' for more information.
-----------------------------------------------------------------------------------
kevan@coltrane:/> deploy/list-modules
Connecting to Geronimo server: localhost:1099
Username: system
Password: *******
Connection established
Found 84 modules
 + org.apache.geronimo.configs/activemq-broker/2.1/car
 + org.apache.geronimo.configs/activemq-ra/2.1/car
 + org.apache.geronimo.configs/axis/2.1/car
...

The help command will display all GShell commands that are available in the current environment.

kevan@coltrane:/> help

For information about Apache Geronimo, visit:
    http://geronimo.apache.org

Available commands:
  execute-alias         Execute an alias
  exit                  Exit the shell
  print                 Alias to: echo
  alias                 Create an alias
  source                Load a file/url into the current shell
  ?                     Alias to: help
  .                     Alias to: source
  unalias               Remove an alias
  unset                 Unset a variable
  help                  Show command help
  echo                  Echo or print arguments to STDOUT
  clear                 Clear the terminal screen
  quit                  Alias to: exit
  set                   Set a variable

  remote-control

  server-control        Remote server control


  deploy

  undeploy              Undeploy a module
  connect               Connect to a Geronimo server
  install-library       Install library
  stop                  Stop a module
  list-targets          List targets
  restart               Restart a module
  install-plugin        Install a plugin
  list-plugins          Install plugins into a geronimo server
  start                 Start a module
  assemble              Extract a geronimo server from the current one
  deploy                Deploy a module
  list-modules          List modules
  redeploy              Redeploy a module
  distribute            Distribute a module
  disconnect            Disconnect from a Geronimo server


  remote

  rsh-server            Start a GShell server
  rsh                   Connect to a remote GShell server


  geronimo

  stop-server           Stop a Geronimo server
  start-client          Start a Geronimo application client
  start-server          Start a Geronimo server

The quit command will exit the GShell environment.

To obtain help information on any command, use the --help option:

kevan@coltrane.local:/> deploy/list-modules --help
list-modules
 --

  TARGET                           Target name
  -a (--all)                       Show started or stopped modules
  -h (--help)                      Display this help message
  -p (--port) N                    Port, default 1099
  -r (--started)                   Show started modules only
  -s (--hostname, --server) VAL    Hostname, default localhost
  -t (--stopped)                   Show stopped modules only
  -u (--username) VAL              Username
  -w (--password) VAL              Password

Geronimo GShell Commands

The following list shows the Geronimo specific commands available:

deploy/deploy                Deploy a module
deploy/undeploy              Undeploy a module
deploy/start                 Start a module
deploy/stop                  Stop a module
deploy/restart               Restart a module
deploy/list-modules          List modules
deploy/redeploy              Redeploy a module
deploy/distribute            Distribute a module

deploy/connect               Connect to a Geronimo server
deploy/disconnect            Disconnect from a Geronimo server

deploy/install-library       Install library
deploy/list-targets          List targets

deploy/install-plugin        Install a plugin
deploy/list-plugins          Install plugins into a geronimo server

deploy/assemble              Extract a geronimo server from the current one

geronimo/start-server        Start a Geronimo server
geronimo/stop-server         Stop a Geronimo server

geronimo/start-client        Start a Geronimo application client

Starting and Stopping Geronimo in Gshell

Geronimo can be started through gshell using the geronimo/start-server command.

jason@Jason-Warners-Computer.local:/> geronimo/start-server --background
Launching Geronimo Server...
Booting Geronimo Kernel (in Java 1.5.0_13)...

If the --background option is not used, then the server instance will maintain control of the terminal and a new instance of gshell must be started to interact with the server.

Other useful geronimo/start-server options (Use geronimo/start-server --help to see a full list of options).

start-server
 --

  -A (--javaagent) JAR           Use a specific Java Agent, set to 'none' to dis
                                 able
  -D (--property) NAME=VALUE     Define system properties
  -G (--gproperty) NAME=VALUE    Define an org.apache.geronimo property
  -H (--home) DIR                Use a specific Geronimo home directory
  -J (--javaopt) FLAG            Set a JVM flag
  -b (--background)              Run the server process in the background
  -h (--help)                    Display this help message
  -j (--jvm) DIR                 Use a specific Java Virtual Machine for server
                                 process
  -l (--logfile) FILE            Capture console output to file
  -m (--module) NAME             Start up a specific module by name
  -q (--quiet)                   Suppress informative and warning messages
  -t (--timeout) N               Specify the timeout for the server process in s
                                 econds
  -v (--verbose)                 Enable verbose output; specify multipule times
                                 to increase verbosity

Geronimo can be stopped using the geronimo/stop-server command.

jason@Jason-Warners-Computer.local:/> geronimo/stop-server -u system -w manager
Stopping Geronimo server: localhost:1099
[] received stop signal

If username -u and password -w are not provided on the command line, the user will be prompted for them before the server shutdown process is started. The full set of geronimo/stop-server options can be seen in gshell using the --help option, the same way as for geronimo/start-server.

On a Windows platform
Use forward slash "/" instead of traditional back slash "\" as directory seperators.
For example:
jason@Local:/> geronimo/start-server -j 'c:/programme files/Java60/bin/java.exe'

This issue is addressed by (https://issues.apache.org/jira/browse/GERONIMO-4709)

Connecting to an Already Running Geronimo Instance

deploy/connect can be used to connect to an instance of Geronimo that is already running. If no options are provided, then the default port (1099) and host (localhost) will be used to connect to a server. The -p option can be used to specify a different port and -s to specify a remote hostname.

jason@Jason-Warners-Computer.local:/> deploy/connect --port 1099 --hostname foo.bar.com
Connecting to Geronimo server: foo.bar.com:1099
Username: system
Password: *******

deploy/disconnect can be used to disconnect from an already connected instance of Geronimo. Since only one instance of Geronimo can be connected at a time, no options are needed to specify which server to disconnect from.

jason@Jason-Warners-Computer.local:/> deploy/disconnect
Disconnecting from Geronimo server
Connection ended

Deploying an Application to a Server Instance

Deploy

deploy/deploy can be used to deploy a module to the geronimo instance that is currently connected.

A module file can be one of the following:

  • J2EE Enterprise Application Archive (EAR) file
  • J2EE Web Application Archive (WAR) file
  • J2EE Enterprise JavaBean Archive (JAR) file
  • J2EE Java Resource Archive (RAR) file
jason@butters:/> deploy/deploy <module>             
Connecting to Geronimo server: localhost:1099
Username: system
Password: *******

The -u and -w options can be used to provide username and password when issuing the command. The -s option can be used to specify the hostname. If none specified, then the hostname defaults to localhost. Likewise -p can be used to specify a port to contact the host on with 1099 being the default. -i can be used to specify an inPlace deployment from the directory you are actually developing the application. In that instance, the path to the application would need to be provided in place of the location of the module.

A deployment plan is necessary to deploy an application. If the deployment plan is not in the WEB-INF directory of a module, then its location must be specified after the module in the command.

jason@butters:/> deploy/deploy <module> <deployment plan>              

Redeploy

deploy/redeploy is used to deploy a newer version of a module onto a server where the older module is already deployed. It functions in a similar way to deploy/deploy but lacks an inPlace deployment option. The username and password is still required and can be provided via command line (-u and -w) or through a prompt after the command is issued. As with the deploy command, the user can specify both port (-p) and hostname (-s) if they differ from the defaults

jason@butters:/> deploy/redeploy -u system -w manager <module>

Undeploy

deploy/undeploy is used to properly remove a module from a server. The command takes the username (-u) and password (-w) options. If not provided, the user will be prompted. As with the deploy command, the user can specify both port (-p) and hostname (-s) if they differ from the defaults. The module id must be provided for the module you wish to undeploy.

jason@butters:/> deploy/undeploy -u system -w manager <module_id>

Distribute

deploy/distribute works exactly like deploy/deploy except the module is not started once it has been deployed into the server and is not marked to be started each time the server starts. The command can be issued in the same way, with the same options, as deploy/deploy.

jason@butters:/> deploy/distribute -u system -w manager <module> <deployment plan>