Skip to content

Run as service on linux (systemd)

BWS Systems edited this page Jul 30, 2019 · 2 revisions

The following steps describe, how to set up habridge as a service on a linux system with systemd (for example debian).

  1. create script

sudo vi /etc/systemd/system/habridge.service

contents (in this example it is already installed on /home/myuser/habridge):

[Unit]
Description=HA Bridge

Wants=network.target
After=syslog.target network-online.target

[Service]
Type=simple
WorkingDirectory=/home/myuser/habridge
ExecStart=/usr/bin/java -jar -Dconfig.file=/home/myuser/habridge/data/habridge.config -Dserver.port=80 /home/myuser/habridge/ha-bridge-5.1.0.jar
Restart=on-failure
RestartSec=10
KillMode=process

[Install]
WantedBy=multi-user.target
  1. reload services

sudo systemctl daemon-reload

  1. Enable the service

sudo systemctl enable habridge

  1. Start the service

sudo systemctl start habridge

  1. Check the status of your service

sudo systemctl status habridge