Last active
April 28, 2019 14:56
-
-
Save esamson/97d183e3225a2965d979 to your computer and use it in GitHub Desktop.
systemd service file for sonatype nexus. Put this in `$HOME/.config/systemd/user/nexus.service`. Launch with `systemctl --user start nexus`.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
default.target.wants/ | |
nexus |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[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 |
@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.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@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....