Traditionally the CmsShell had to be run in a separate process. In case you have an OpenCms server running, this means that the server and the CmsShell would be 2 different processes with no shared runtime settings. So with the traditional CmsShell it is not possible to manipulate a running server.
Enter the CmsRemoteShell. This is an RMI based version of the CmsShell that is optionally started by the OpenCms server. If the CmsRemoteShell has been activated, it is possible to connect to the server and run a set of shell command in the server process.
The CmsRemoteShell can be accessed only from the server where the OpenCms instance is running. This is a security feature. The reasoning is that in case you do remote server management, you should already have an environment that allows you to trigger scripts on your OpenCms server in a secure way.
The CmsRemoteShell can be enabled in the opencms-system.xml configuration file.
Insert this XML at the last position before the closing </system> tag:
<shell-server enabled="true" port="1101" />
To call the CmsRemoteShell, use the following command:
java -cp $OPENCMS_WEBAPP_DIR/WEB-INF/lib/opencms.jar org.opencms.rmi.CmsRemoteShellClient [options]
Description of options with examples:
-script=filename.txtfilename.txt instead of reading commands interactively.
Important: In case you run a script, make sure the last command in the script is exit,
otherwise the shell will not terminate.-registryPort=1101-additional=org.opencms.ocee.cluster.CmsClusterShellCommands