Skip to content

Instantly share code, notes, and snippets.

@cwilper
Created January 26, 2017 16:52
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save cwilper/cd1fe3525edba1cc7a32340327a359ed to your computer and use it in GitHub Desktop.
Save cwilper/cd1fe3525edba1cc7a32340327a359ed to your computer and use it in GitHub Desktop.
Systemd Unit file for Handle Service used by DSpace
# Systemd Unit file for Handle Service used by DSpace
#
# On hosts that use systemd, like RHEL7, this can be used to auto-start
# the handle service and provide the familiar "servicectl start|status|stop"
# commands for controlling execution.
#
# To install:
#
# 1) As dspace:
# REQUIRED:
# - Rename dspace/bin/start-handle-server to run-handle-server,
# and remove "nohup" and the trailing ampersand from the last line.
# OPTIONAL:
# - Create start-handle-server, with the following lines, not indented:
# #!/bin/sh
# sudo systemctl start handle
# ..and make sure it's executable (e.g. chmod 755 start-handle-server)
# 2) As root:
# REQUIRED:
# - Copy this file into /etc/systemd/system and change the path for
# ExecStart's value as appropriate.
# - Run the following to install and make it start at system startup:
# systemctl daemon-reload
# systemctl enable handle
# OPTIONAL:
# - Modify /etc/sudoers (using visudo) to allow the dspace user
# to run "sudo systemctl start|stop|status handle" with no password:
# dspace ALL=(root) NOPASSWD: /bin/systemctl start handle
# dspace ALL=(root) NOPASSWD: /bin/systemctl stop handle
# dspace ALL=(root) NOPASSWD: /bin/systemctl status handle
[Unit]
Description=Handle Service
After=syslog.target network.target
[Service]
Type=simple
ExecStart=/opt/dspace/dspace/bin/run-handle-server
ExecStop=/bin/kill $MAINPID
User=dspace
Group=dspace
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment