-
-
Save esamson/97d183e3225a2965d979 to your computer and use it in GitHub Desktop.
default.target.wants/ | |
nexus |
[Unit] | |
Description=Sonatype Nexus | |
[Service] | |
Type=forking | |
PIDFile=%h/.local/opt/nexus/bin/jsw/linux-x86-64/nexus.pid | |
ExecStart=%h/.local/opt/nexus/bin/nexus start | |
ExecReload=%h/.local/opt/nexus/bin/nexus restart | |
ExecStop=%h/.local/opt/nexus/bin/nexus stop | |
[Install] | |
Alias=nexus | |
WantedBy=default.target |
In 2.14.0-01 there's no nexus.pid there's only wrapper.. Should I use that instead?
on nexus 3.2
[Unit]
Description=nexus service
After=network.target
[Service]
Type=forking
ExecStart=/opt/nexus/bin/nexus start
ExecStop=/opt/nexus/bin/nexus stop
User=nexus
Restart=on-abort
[Install]
WantedBy=multi-user.target
Nexus 3.6 on CentOS 7
Note that I needed to set the INSTALL4J_JAVA_HOME
env var, as I do not have a globally defined java
in the path. Also I needed to increase the number of file descriptors, i.e. the LimitNOFILE
property.
[Unit]
Description=Sonatype Nexus Repository Manager
After=network.target
[Service]
Type=forking
ExecStart=/apps/nexus/current/bin/nexus start
ExecStop=/apps/nexus/current/bin/nexus stop
User=nexus
Restart=on-abort
Environment=INSTALL4J_JAVA_HOME=/foo/bar/jre8
LimitNOFILE=65536
[Install]
WantedBy=multi-user.target
@Ibruun's solution is the one currently used by Sonatype at
https://help.sonatype.com/repomanager3/installation/run-as-a-service#RunasaService-systemd
But the fact that systemd still starts an (really complex) init script /apps/nexus/current/bin/nexus
is jarring; that's not how it is supposed to be done....
@dtonhofer instead of ./bin/nexus start
, do you think ./bin/nexus run
would work with Type=simple
?
@glynnforrest I don't know, you will have to try. But there is no good reason to change from the forking modus, is there?
@dtonhofer I did run it but wasn't sure if it would break nexus in some subtle way. nexus run
spits the logs out to stdout so they appear in the systemd journal, which is quite handy.
Great script. I left out the PIDFile originally and suffered for it. Without it, systemd does not realize that the service is actually starting and it immediately kills the service.