Page History
...
- A startup and shutdown configuration can be used for Unix systems that is executed by
systemd
running for theroot
account. - There are a number of ways how of writing
systemd
service files - however, the sections below explain the best practices for use ofsystemd
with JS7 componentsproducts.
Controller
Location of Service File
The following service file will be created when extracting the Controller instance from the downloaded archive:
...
/usr/lib/systemd/system
/etc/systemd/system
When using JS7 - Automated Installation and Update then the systemd service file can be automatically created.
Controller Service File
The example file for the Controller daemon includes a number of placeholders that can be replaced as follows:
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
[Unit] Description=SOS JS7 Controller -id=jobschedulercontroller After=syslog.target After=network.target [Service] # Optionally set JAVA_HOME environment variable if not specified with the Controller's Instance Start Script # Environment="JAVA_HOME=/usr/lib/jvm/java-1.8-openjdk/" # Optionally set JAVA_OPTIONS # Environment="JAVA_OPTIONS='-Djavax.net.debug=sslXmx500m'" Type=forking KillMode=process # default <JS7_CONTROLLER_PID_FILE_DIR> = <INSTALL_PATH>/var/logs PIDFile=/var/sos-berlin.com/js7/controller>controller/logs/controller.pid ExecStart=/opt/sos-berlin.com/js7/controller/bin/controller_instance.sh start ExecStartPost=/bin/sleep 1 ExecStop=/opt/sos-berlin.com/js7/controller/bin/controller_instance.sh stop ExecReload=/opt/sos-berlin.com/js7/controller/bin/controller_instance.sh restart User=js7 StandardOutput=syslogjournal+console StandardError=syslogjournal+console TimeoutStopSec=60 TasksMax=infinity [Install] WantedBy=multi-user.target |
...
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. Note thatsystemd
will not run the user accounts' profile when switching to the user account. - If a JDK is used then specify the folder in which the JDK is installed.
- If a JRE is used then specify the folder in which the JRE is installed.
- the Instance Start Script .
Environment="JAVA_OPTIONS=..."
Optionally set Java options, e.g. specify the heap size or debugging options, if not provided by the Controller's ./bin/controller_instance.sh
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 will be located in thelogs
directory.ExecStart, ExecStop, ExecReload
The start, stop and restart operations for the Controller are performed by running the Controller's Instance Start Script.- When stopping the Controller then this is considered normal termination and no fail-over occurs in a Controller Cluster.
- Users who wish to perform fail-over in a Controller Cluster on stop of a Controller instance should add the option:
controller_instance.sh stop --fail-over
. For details see JS7 - Controller - Command Line Operation.
User=js7
The example assumes that the Controller is operated with thejs7
user account. If theJS7_USER
environment variable is set from the Controller's Instance Start Script then the values have to match.TimeoutStopSec
: The number of seconds that systemd will wait for the Controller to stop. Consider that timeouts optionally specified on Controller start are counted towards the systemd timeout. Users must ensure that the Controller is terminated when the systemd timeout is exceeded. For details see JS7 - Controller - Command Line Operation.
Agent
Location of Service File
...
/usr/lib/systemd/system
/etc/systemd/system
When using JS7 - Automated Installation and Update then the systemd service file can be automatically created.
Agent Service File
The example file for the Agent daemon includes a number of placeholders that can be replaced as follows:
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
[Unit] Description=SOS JS7 Agent -port=4445 After=syslog.target After=network.target [Service] # Optionally set JAVA_HOME environment variable if not specified with the Agent's Instance Start Script # Environment="JAVA_HOME=/usr/lib/jvm/java-1.8-openjdk/" # Optionally set JAVA_OPTIONS # Environment="JAVA_OPTIONS='-Djavax.net.debug=sslXmx256m'" Type=forking KillMode=process # default <JS7_AGENT_PID_FILE_DIR> = <INSTALL_PATH>/var_<JS7_AGENT_HTTP_PORT>/logs PIDFile=/var/sos-berlin.com/js7/agent/logs/agent.pid ExecStart=/opt/sos-berlin.com/js7/agent/bin/agent_4445.sh start ExecStartPost=/bin/sleep 1 ExecStop=/opt/sos-berlin.com/js7/agent/bin/agent_4445.sh stop ExecReload=/opt/sos-berlin.com/js7/agent/bin/agent_4445.sh restart User=js7 StandardOutput=syslogjournal+console StandardError=syslogjournal+console TimeoutStopSec=60 TasksMax=infinity [Install] WantedBy=multi-user.target |
...
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. Note thatsystemd
will not run the user accounts' profile when switching to the user account. - If a JDK is used then specify the folder in which the JDK is installed.
- If a JRE is used then specify the folder in which the JRE is installed.
- the Instance Start Script .
Environment="JAVA_OPTIONS=..."
Optionally set Java options, e.g. to specify the heap size or debugging options, if not provided by the Agent's ./bin/agent_<port>.sh
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 start, stop and restart operations for the Agent are 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.TimeoutStopSec
: The number of seconds that systemd will wait for the Agent to stop. Consider that timeouts optionally specified on Agent start are counted towards the systemd timeout. Users must ensure that the Agent is terminated when the systemd timeout is exceeded. For details see JS7 - Agent Command Line Operation.
JOC Cockpit
Location of Service File
...
/usr/lib/systemd/system
/etc/systemd/system
When using JS7 - Automated Installation and Update then the systemd service file can be automatically created.
JOC Cockpit Service File
The example file for the JOC Cockpit daemon includes a number of paths that are populated by the installer:
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
[Unit] Description=Jetty for SOS JS7 JOC Cockpit After=syslog.target After=network.target [Service] # Optionally set JAVA_HOME environment variable if necessary # Environment="JAVA_HOME=/usr/lib/jvm/java-1.8-openjdk" # Optionally set JAVA_OPTIONS # Environment="JAVA_OPTIONS='-Djavax.net.debug=sslXmx500m'" Type=forking PIDFile=/var/sos-berlin.com/js7/joc/joc.pid ExecStart=/opt/sos-berlin.com/js7/joc/jetty/bin/jetty.sh start ExecStartPost=/bin/sleep 1 ExecStop=/opt/sos-berlin.com/js7/joc/jetty/bin/jetty.sh stop ExecReload=/opt/sos-berlin.com/js7/joc/jetty/bin/jetty.sh restart User=js7 StandardOutput=syslogjournal+console StandardError=syslogjournal+console SuccessExitStatus=143 TimeoutStopSec=60 [Install] WantedBy=multi-user.target |
...
- Ensure that the
controller
service name corresponds to thecontroller.service
service file name. - For unique service names users can rename the service file, for example to
js7_controller.service
. - The command
systemctl daemon-reload
has to be re-executed after any later change to a service file.
...
- Ensure that the
controller
service name corresponds to thecontroller.service
. service file name. - For unique service names users can rename the service file, for example to
js7_controller.service
. - The above examples apply similarly to the Agent and JOC Cockpit.