Skip to content

Instantly share code, notes, and snippets.

@redlotus
Created August 3, 2018 10:24
Show Gist options
  • Save redlotus/a6917707aaf4324a645dd696b8dcb184 to your computer and use it in GitHub Desktop.
Save redlotus/a6917707aaf4324a645dd696b8dcb184 to your computer and use it in GitHub Desktop.
omnidb-server-service

Hello, sorry for the delay :(

You could do something like this:

vim /lib/systemd/system/omnidb-server.service

Fill it with:

[Unit]
Description=OmniDB: executes omnidb-server.

[Service]
Type=forking
ExecStart=/bin/bash -c "omnidb-server &"
RemainAfterExit=yes
User=root
Group=root
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=omnidb-server

[Install]
WantedBy=multi-user.target

You must change User and Group to the user and group where omnidb-server is installed. In my case, it's root and root.

Type=forking will make it possible to use systemctl start and stop statements.

ln -s /lib/systemd/system/omnidb-server.service /etc/systemd/system/omnidb-server.service

systemctl daemon-reload

And, to add output to rsyslog and save it to file /var/log/omnidb-server.log:

vim /etc/rsyslog.d/omnidb-server.conf

Content:

if $programname == 'omnidb-server' then /var/log/omnidb-server.log
if $programname == 'omnidb-server' then ~
systemctl restart rsyslog

systemctl start omnidb-server
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment