search

Friday, October 28, 2016

systemd: Create a service

Example of the service configuration file `selenium_hub.service`:
[Unit]
Description=Selenium hub

[Service]
Environment=DISPLAY=:99
ExecStart=/bin/bash -c 'java -jar /opt/selenium/selenium-server-standalone.jar -role hub'
User=root

[Install]
WantedBy=multi-user.target
Place this file to /etc/systemd/system/ (symlinking won't work) and refresh available services:
sudo systemctl daemon-reload
Now it is possible to start the service with command:
sudo service selenium_hub status
You can also make it start when a system starts by executing one of the following commands:
sudo chkconfig selenium_hub on
sudo systemctl enable selenium_hub.service

No comments:

Post a Comment