[CentOS] Help with systemd

Wed Sep 23 21:58:52 UTC 2015
Jonathan Billings <billings at negate.org>

On Thu, Sep 24, 2015 at 09:36:59AM +1200, Clint Dilks wrote:
> # 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"

2 Comments here:

1.) why 'cd /greenstone/gs3 && ant start' when you could just run
'/greenstone/gs3/ant start'.  
2.) You're going through a lot of effort to generate a pidfile, when
it's completely unnecesary for systemd services.

You could probably replace the ExecStart with:

ExecStart=/greenstone/gs3/ant start

... and get rid of the PIDFile.

-- 
Jonathan Billings <billings at negate.org>