[CentOS] Help with systemd

Wed Sep 23 21:36:59 UTC 2015
Clint Dilks <clintd at waikato.ac.nz>

Hi

I am trying to get Greenstone3 http://www.greenstone.org/download to work
with systemd.
So far I have come up with the following which works but feels more like a
hack than a solution.
Does anyone have any suggestions on how to do this better ?

# cat /etc/tmpfiles.d/greenstone3.conf
d /run/greenstone3 0755 gs3 gs3 -

# cat /etc/systemd/system/greenstone3.service
# Systemd unit file for Greenstone 3
[Unit]
Description=Greenstone 3 Server
After=syslog.target network.target

[Service]
Type=forking
PIDFile=/run/greenstone3/greenstone3.pid
Environment=PATH=/usr/apache-ant-1.9.6/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin

ExecStart=/usr/bin/bash -c "cd /greenstone/gs3/ && ant start ;
/usr/sbin/pidof java | awk '{print $1}' > /run/greenstone3/greenstone3.pid"

SuccessExitStatus=143
User=gs3
Group=gs3

[Install]
WantedBy=multi-user.target


Thanks