Start/Stop an nJAMS instance#

This chapter describes how to start and stop an nJAMS instance on Linux/Unix and Windows, as well as the supported shutdown methods. It also explains why certain stop methods are not recommended and the risks of using them.

The nJAMS Installer creates start/stop scripts for all subsystems that have been installed. The scripts are available for Windows and Linux/Unix.

Linux/Unix#

Use the following scripts to start/stop the nJAMS instance are located in <njams_installation_dir>/bin

Script

Description

startAll.sh

Starts all installed nJAMS components on this machine

stopAll.sh

Stops all installed nJAMS components on this machine

njams-shutdown.sh

Stops nJAMS Server (used by stopAll.sh)

Windows#

On Windows the following scripts to start/stop the nJAMS instance are located in <njams_installation_dir>\bin

Script

Description

startAll.bat

Starts all Windows Services of installed nJAMS subsystems on this machine

stopAll.bat

Stops all Windows Services of installed nJAMS subsystems on this machine

njams-shutdown.bat

Stops nJAMS Server (used by stopAll.bat)

On Windows systems, use the Task Manager to find the Java process that runs the WildFly Application Server, which starts with the instance name specified during installation (for example, njams_ if the instance name was set to njams).

Windows Service

You can stop Cerebro and Elasticsearch by stopping their corresponding Windows services. However, you should not restart WildFly (nJAMS) that way. To stop WildFly/nJAMS, use one of the methods explained in the following section.

Warning

Stopping WildFly/nJAMS by stopping the service can lead to data loss and hanging shutdown.

Shutting down nJAMS Server (WildFly) only#

The correct shutdown of nJAMS Server is essential for the integrity of an nJAMS instance. An improper shutdown can lead to data loss. Hence, it’s important to use one of the official approaches for shutdown nJAMS Server.

Shutdown using nJAMS UI#

Go to “Administration” area and select “Deployment” tab. On this page click the SHUTDOWN button:

Shutdown via UI

Shutdown from console using shutdown script#

nJAMS installer creates a shutdown script named njams-shutdown.sh in <njams_installation_dir>/bin folder. Run this script for triggering nJAMS shutdown process. This script corresponds to clicking the SHUTDOWN button in nJAMS UI.

Shutdown from console using marker file#

You can manually create the shutdown marker used by the script.

Place a file named: njams.shutdown into <njams_installation_dir>/wildflyXX/standalone/deployments

Shutdown from console using nJAMS REST API#

For shutting down nJAMS Server via nJAMS REST API, you need to login to nJAMS Server with a user that has server-operator privilege and then execute the shutdown command.

Use the following curl snippets as reference:

curl -u <user>:<password> \
 -X DELETE \
 -H "Cache-Control: no-cache" \
 "http://<host>:<port>/njams/api/server/"

Killing nJAMS Server process#

Killing the nJAMS Server process should only be applied as last resort, if nJAMS is not responding at all or not shutting down by one of the previous procedures.

Warning

Killing nJAMS Server process can lead to data loss.

Linux:

Use the following command for identifying the nJAMS Server process running in WildFly application server:

ps -ef | grep wildfly

Then kill the process using it’s PID found with the previous command:

kill -9 <PID>
Windows:
  1. Open the Task Manager.

  2. Go to the Details tab.

  3. Locate the java.exe process that corresponds to the WildFly Application Server for your nJAMS Server instance (look for the instance name in the command line details, e.g., njams_).

  4. Select the process, right-click, and choose End Task.

Unsupported Stop options#

The following options commonly attempt to stop WildFly application server without shutting down the nJAMS services before and should NOT be used:

  • Using the WildFly command line interface (CLI)

  • Stopping WildFly from its management console application

  • Using kill (kill -15, or kill -SIGTERM) command. See information in the above section for using kill -9 or kill -SIGKILL

  • Stopping the WildFly Windows service (njams_wildflyXX)

Warning

All previous options are no proper way for shutting down nJAMS Server and should NOT be used. They most likely lead to data loss and hanging shutdown.

Recommendation#

When you use the internal database of nJAMS Server it is recommended to restart nJAMS Server from time to time. A restart will help to defragment and compress the internal database. However, this is just a recommendation to keep the internal database performant, it is not a must. This recommendation does not apply, when you use an external RDBMS.