klaros as a service ubuntu

Aditya Vijjan, modified 5 Years ago.

klaros as a service ubuntu

Youngling Posts: 2 Join Date: 7/16/19 Recent Posts
I have created Klaros.service file in /etc/systemd/system and below id the file config. I am able to start stop klaros service.

[Unit]
Description=Klaros
After=network.target

[Service]
Type=forking

ExecStart=/opt/klaros-testmanagement/bin/startup.sh
ExecStop=/opt/klaros-testmanagement/bin/shutdown.sh

When i am trying to enable klaros service by systemctl enable klaros i received below details.

 sudo systemctl enable klaros

The unit files have no installation config (WantedBy, RequiredBy, Also, Alias
settings in the [Install] section, and DefaultInstance for template units).
This means they are not meant to be enabled using systemctl.
Possible reasons for having this kind of units are:
1) A unit may be statically enabled by being symlinked from another unit's
   .wants/ or .requires/ directory.
2) A unit's purpose may be to act as a helper for some other unit which has
   a requirement dependency on it.
3) A unit may be started when needed via activation (socket, path, timer,
   D-Bus, udev, scripted systemctl call, ...).
4) In case of template units, the unit is meant to be enabled with some
   instance name specified.
thumbnail
Torsten Stolpmann, modified 5 Years ago.

RE: klaros as a service ubuntu (Answer)

Jedi Council Member Posts: 756 Join Date: 2/12/09 Recent Posts
Haven't verified this yet, I think you are missing something like this:

[Install]
WantedBy=multi-user.target
I will check back later once verified.

Regards,

Torsten
thumbnail
Torsten Stolpmann, modified 5 Years ago.

RE: klaros as a service ubuntu

Jedi Council Member Posts: 756 Join Date: 2/12/09 Recent Posts
Hello Aditya,

the following is a verified solution for systemd (/etc/systemd/system/klaros.service):

[Unit]
Description=Klaros Testmanagement Service
After=syslog.target network.target

[Service]
Type=forking
User=klaros

ExecStart=/opt/klaros-testmanagement/bin/startup.sh
ExecStop=/opt/klaros-testmanagement/bin/shutdown.sh

[Install]
WantedBy=multi-user.target

Please note that the User=klaros setting requires the creation of a user and setting the correct ownership for /opt/klaros-testmanagement:

adduser klaros
chown -R klaros /opt/klaros-testmanagement

There is no need to run Klaros under a root account and we discourage users to do so.

Hope this helps, please  let me know if this works for you.

Torsten