How do I run a Remote Connector Server (RCS) as a Service?
The purpose of this article is to provide instructions on running the RCS as a service, which allows you to stop and start the RCS using systemd if you are using a Linux® system. This information applies if you are using the RCS with ForgeRock Identity Cloud or IDM.
Overview
The following instructions were tested on Ubuntu 20.04 LTS but they should work (with no/minimal changes) on any Linux distribution using systemd.
These instructions assume you have unpacked the RCS package into the /opt directory and left the unpacked directory name unchanged (openicf). If you have any variations on these path locations, you must update the service file accordingly when following the instructions in Step 2.
Configuring RCS as a service
- Create a service file (called rcs.service) in the /etc/systemd/system directory, for example:$ sudo vim /etc/systemd/system/rcs.service
- Add the following
content to this file, update as needed and save: [Unit] SourcePath=/opt/openicf/bin Description=ForgeRock Remote Connector Server (systemd init) After=network.target Conflicts=shutdown.target [Service] Type=simple Restart=always RestartSec=5sec IgnoreSIGPIPE=no KillMode=process Environment="OPENICF_OPTS=-Xmx1024m" ExecStart=/opt/openicf/bin/ConnectorServer.sh /start [Install] WantedBy=multi-user.target - Make the new service launch on startup by running the following command:$ sudo systemctl enable rcs.service
- Check the service is enabled:$ systemctl is-enabled rcs.serviceThis command simply returns
enabled
ordisabled
as appropriate.
Starting, stopping and restarting the RCS service
Once you have configured RCS as a service and checked it is enabled, you can use the following commands to start, stop and restart the RCS service:
- Start:$ sudo systemctl start rcs.service
- Stop:$ sudo systemctl stop rcs.service
- Restart:$ sudo systemctl restart rcs.service
Checking the service status
You can check that the RCS service has started or stopped as expected using the following command:$ systemctl status rcs.service
This command will return the service state and the first few entries in the log file. For example, the status command’s output will look similar to the following, where systemd messages indicate that the init script has started and the RCS service is running:
● rcs.service - ForgeRock Remote Connector Server (systemd init) Loaded: loaded (/opt/openicf/bin; enabled; vendor preset: enabled) Active: active (running) since Mon 2021-03-08 12:45:16 GMT; 22s ago Main PID: 3080 (java) Tasks: 35 (limit: 4684) CGroup: /system.slice/rcs.service └─3080 java -Xmx512m -server -classpath /opt/openicf/lib/framework/*:/opt/openicf/lib/framework/ org.forgerock.openicf.framework.server.Main -service -properties /opt/openicf/conf/ConnectorServer.properties Mar 08 12:45:29 forgerock-VirtualBox ConnectorServer.sh[3080]: Mar 08, 2021 12:45:29 pm INFO o.f.o.f.c.ClientRemoteConnectorInfoManager: privateConnections size: 0; privateTCPConnections size 0. Mar 08 12:45:29 forgerock-VirtualBox ConnectorServer.sh[3080]: Mar 08, 2021 12:45:29 pm INFO o.f.o.f.c.ClientRemoteConnectorInfoManager: Entering connection housekeeping... 0 active WebSocket(s), 2 available permits, 3 permitted permits Mar 08 12:45:29 forgerock-VirtualBox ConnectorServer.sh[3080]: Mar 08, 2021 12:45:29 pm INFO o.f.o.f.c.ClientRemoteConnectorInfoManager: 0 active WebSocket(s), 2 remaining permits
See Also
How do I implement a Java Remote Connector Server (RCS) for Identity Cloud?
How do I upgrade the Java Remote Connector Server (RCS) for Identity Cloud and IDM?