Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • A startup and shutdown configuration can be used for Unix systems that is executed by systemd running for the root account.
  • There are a number of ways how of writing systemd service files - however, the sections below explain the best practices for use of systemd  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
languagebash
titleExample for Controller service file
linenumberstrue
collapsetrue
[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

...

  • /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
languagebash
titleExample for Agent service file
linenumberstrue
collapsetrue
[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

...

  • /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
languagebash
titleExample for JOC Cockpit service file
linenumberstrue
collapsetrue
[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 the controller.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 the controller.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.

...