License Type | On-Premise (Pre 3.6.9) |
Agent Mode | N/A |
Main Product Category | Contrast UI |
Sub Category | Installation |
Note: As of 3.6.9 the Contrast UI installer configures this functionality by default so there is no need to set it up manually as described below.
Objective
By default, when installing the Contrast server on Linux, an init.d
task is created which allows it to automatically startup as the OS starts up. However, some Linux distro's are moving to use systemd
as the default means of starting/stopping services.
The following process shows how to create a systemd
service for the Contrast server to allow it to be controlled with systemctl
.
Process
We'll first need to create the following file at the given location:
/etc/systemd/system/contrast-server.service
The contents of this file will be:
[Unit] Description=Contrast Server
[Service] Type=forking ExecStart=/opt/contrast/bin/contrast-server start ExecStop=/opt/contrast/bin/contrast-server stop User=contrast_service
TimeoutSec=900
[Install] WantedBy=multi-user.target
Note:
/opt/contrast
is given here as an example of the Contrast server installation directory, it should be replaced with the actual install directory. Some Linux distributions don't allow for relative paths or variables to be used within systemd
services.Once in place, run the following command to load your new systemd
service:
sudo systemctl daemon-reload
Finally, you can start and stop the Contrast server with the following commands:
sudo systemctl start contrast-server sudo systemctl stop contrast-server
The Contrast server should also start when the OS starts.