Skip to content

Instantly share code, notes, and snippets.

@vulcangz
Forked from hammady/solr.service
Created January 3, 2022 08:07
Show Gist options
  • Save vulcangz/de5e6a179dd3ad116830f574ad5dd106 to your computer and use it in GitHub Desktop.
Save vulcangz/de5e6a179dd3ad116830f574ad5dd106 to your computer and use it in GitHub Desktop.

Revisions

  1. @hammady hammady created this gist Jan 9, 2017.
    25 changes: 25 additions & 0 deletions solr.service
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,25 @@
    # put this file in /etc/systemd/system/ as root
    # below paths assume solr installed in /opt/solr, SOLR_PID_DIR is /data
    # and that all configuration exists in /etc/default/solr.in.sh which is the case if previously installed as an init.d service
    # change port in pid file if differs
    # note that it is configured to auto restart solr if it fails (Restart=on-faliure) and that's the motivation indeed :)
    # to switch from systemv (init.d) to systemd, do the following after creating this file:
    # sudo systemctl daemon-reload
    # sudo service solr stop # if already running
    # sudo systemctl enable solr
    # systemctl start solr
    # this was inspired by https://confluence.t5.fi/display/~stefan.roos/2015/04/01/Creating+systemd+unit+(service)+for+Apache+Solr
    [Unit]
    Description=Apache SOLR
    After=syslog.target network.target remote-fs.target nss-lookup.target systemd-journald-dev-log.socket
    Before=multi-user.target graphical.target nginx.service
    Conflicts=shutdown.target
    [Service]
    User=solr
    PIDFile=/data/solr-8983.pid
    Environment=SOLR_INCLUDE=/etc/default/solr.in.sh
    ExecStart=/opt/solr/bin/solr start
    ExecStop=/opt/solr/bin/solr stop
    Restart=on-failure
    [Install]
    WantedBy=multi-user.target graphical.target