Skip to content

Creating a Journey service using systemd

Kai H edited this page May 12, 2015 · 3 revisions

Systemd is poised to be the standard service manager for Debian (including Ubuntu). Here's a short tutorial on how to create a Journey service on a Linux system running systemd.

1. Install setcap

We will be using setcap to grant special privileges to the Journey executable. This will allow us to run Journey through our default user while still being able to bind to low ports (80 and 443, which only root can bind to).

In Debian (and Ubuntu), setcap is part of the libcap2-bin package. You can install it by running:

apt-get install libcap2-bin

NOTE: If you plan on running Journey only on ports higher than 1024, you may skip this step and also delete the following line in the service file in step 2:

ExecStartPre=/sbin/setcap 'cap_net_bind_service=+ep' /home/youruser/journey/journey

2. Create the journey.service file

Using nano as the editor:

sudo nano /lib/systemd/system/journey.service

Paste in the following text (and replace every occurrence of "youruser" with your own user name. Of course, if your Journey executable isn't located at /home/youruser/journey/journey you'll have to change that path):

[Unit]
Description=Job that runs the Journey daemon

[Service]
ExecStartPre=/sbin/setcap 'cap_net_bind_service=+ep' /home/youruser/journey/journey
ExecStart=/bin/su - youruser -c "/home/youruser/journey/journey -log=/home/youruser/journey/log.txt"

[Install]
WantedBy=multi-user.target

3. Configure the Journey service to start at boot

To let Journey start automatically after a reboot of your server, run:

sudo systemctl enable journey

Your Journey service is now ready. Start it by running:

sudo service journey start
Clone this wiki locally