Introduction
- For Unix systems a startup and shutdown configuration can be used that is executed by
systemd
running for theroot
account. - There are a number of ways how to write
systemd
service files, however, the below chapters explain best practices for use ofsystemd
with JS7 components.
Controller
Location of Service File
When extracting the Controller instance from the downloaded archive then this will create the following file:
controller/bin/controller.service-example
You can rename the file to controller.service
(or to any other name with the extension .service
) and move the file to one of the known locations for systemd
unit files such as
/usr/lib/systemd/system
/etc/systemd/system
Controller Service File
The example file for the Controller daemon includes a number of placeholders that can be replaced like this:
Explanations:
Environment="JAVA_HOME=..."
Optionally theJAVA_HOME
environment variable can be set to specify the location of the JVM. Alternatively this environment variable can be specified with- the Instance Start Script .
/bin/controller_instance.sh
of the Controller, - the profile, e.g.
$HOME/.bashrc
, of the user account that the Controller is operated for. Consider thatsystemd
will not run the user accounts' profile when switching to the user account. - If a JDK is used then specify the folder to which the JDK is installed.
- If a JRE is used then specify the folder to which the JRE is installed.
- the Instance Start Script .
PIDFile=...
Thecontroller.pid
PID file includes the process ID that is assigned when starting the Controller. if not otherwise specified by the Instance Start Script then the file is located in thelogs
directory.ExecStart, ExecStop, ExecReload
The operation to start, to stop and to restart the Controller is performed by running the Controller's Instance Start Script.User=js7
The example assumes that the Controller is operated for thejs7
user account. If theJS7_USER
environment variable is set from the Controller's Instance Start Script then the values have to match.
Agent
Location of Service File
When extracting the Agent from the downloaded archive then this will create the following file:
agent/bin/agent.service-example
You can rename the file to agent.service
(or to any other name with the extension .service
) and move the file to one of the known locations for systemd
unit files such as
/usr/lib/systemd/system
/etc/systemd/system
Agent Service File
The example file for the Agent daemon includes a number of placeholders that can be replaced like this:
Explanations:
Environment="JAVA_HOME=..."
Optionally theJAVA_HOME
environment variable can be set to specify the location of the JVM. Alternatively this environment variable can be specified e.g. with- the Instance Start Script .
/bin/agent_<port>.sh
of the Agent, - the profile, e.g.
$HOME/.bashrc
, of the user account that the Agent is operated for. Consider thatsystemd
will not run the user accounts' profile when switching to the user account. - If a JDK is used then specify the folder to which the JDK is installed.
- If a JRE is used then specify the folder to which the JRE is installed.
- the Instance Start Script .
PIDFile=...
Theagent.pid
PID file includes the process ID that is assigned when starting the Agent. if not otherwise specified by the Instance Start Script then the file is located in thelogs
directory.ExecStart, ExecStop, ExecReload
The operation to start, to stop and to restart the Agent is performed by running the Agent's Instance Start Script.User=js7
The example assumes that the Agent is operated for thejs7
user account. If theJS7_USER
environment variable is set from the Agent's Instance Start Script then the values have to match.
JOC Cockpit
Location of Service File
- The JOC Cockpit will start for the user account that is specified during installation. The JOC Cockpit start script
jetty.sh
will switch to this account independently from the fact that the start script is executed e.g. bysystemd
using theroot
account. - For use with
systemd
find a sample service file from./bin/joc.service-example
file.
You can rename the file to joc.service
(or to any other name with the extension .service
) and move the file to one of the known locations for systemd
unit files such as
/usr/lib/systemd/system
/etc/systemd/system
JOC Cockpit Service File
The example file for the JOC Cockpit daemon includes a number of paths that are populated by the installer:
Explanations:
Environment="JAVA_HOME=..."
Optionally theJAVA_HOME
environment variable can be set to specify the location of the JVM. Alternatively this environment variable can be specified e.g. with- the Instance Start Script .
/bin/agent_<port>.sh
of the Agent, - the profile, e.g.
$HOME/.bashrc
, of the user account that the Agent is operated for. Consider thatsystemd
will not run the user accounts' profile when switching to the user account. - If a JDK is used then specify the folder to which the JDK is installed.
- If a JRE is used then specify the folder to which the JRE is installed.
- the Instance Start Script .
PIDFile=...
Thejoc.pid
PID file includes the process ID that is assigned when starting JOC Cockpit. By default the file is located in the JETTY_BASE directory.ExecStart, ExecStop, ExecReload
The operation to start, to stop and to restart the Agent is performed by running the JOC Cockpit Start Script.User=js7
The example assumes that the Agent is operated for thejs7
user account. If theJS7_USER
environment variable is set from the Agent's Instance Start Script then the values have to match.
Operation with systemd
How to apply systemd Service Files
After storing a service file to one of the known locations for systemd service files the following commands have to be executed:
Explanations:
- Consider that the name
controller
corresponds to a service file namecontroller.service
. - The command
systemctl daemon-reload
has to be re-executed after any later change to a service file.
How to run systemd Service Files
After storing a service file to one of the known locations for systemd service files the following commands can be executed:
Explanations:
- Consider that the name
controller
corresponds to a service file namecontroller.service
. - The above examples accordingly apply to the Agent and JOC Cockpit.