Luca Burgazzoli created KARAF-4281:
--------------------------------------

             Summary: System scripts: provide Systemd templates to manage Karaf 
child instances
                 Key: KARAF-4281
                 URL: https://issues.apache.org/jira/browse/KARAF-4281
             Project: Karaf
          Issue Type: New Feature
          Components: karaf-os-integration
            Reporter: Luca Burgazzoli
            Priority: Minor


Systemd's has as  a sort of template-engine for unit files which are defined in 
the form of [email protected], i.e. for karaf I've created one named 
[email protected] with content like:

{code}
  [Unit]
  Description=Karaf - %i
  After=syslog.target network.target

  [Service]
  EnvironmentFile=-/etc/karaf/karaf.conf
  Environment=JAVA_HOME=/opt/java/1.8.0
  Environment=KARAF_HOME=/opt/apache/karaf-4
  Environment=KARAF_BASE=/opt/apache/karaf-4/instances/%i

  ExecStart=/opt/apache/karaf-4/bin/karaf daemon
  ExecStop=/opt/apache/karaf-4/bin/karaf stop

  LimitNOFILE=102642

  [Install]
  WantedBy=multi-user.target
{code}

With such configuration, you do not need to create a systemd unit file for each 
child instance but you can leverage [email protected], i.e:

{code}
  systemctl start karaf@instance-1
{code}

A service created in such way can also be configured to auto-start at boot like 
any other Systemd unit:

{code}
  [lb@home]# systemctl enable karaf@instance-1
  Created symlink from /etc/systemd/system/multi-user.target.wants 
/[email protected] to /etc/systemd/system/[email protected]. 
{code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to