[CentOS] systemctl (again)

Sat Apr 4 16:14:08 UTC 2015
Pete Travis <lists at petetravis.com>

On Apr 4, 2015 7:55 AM, "J Martin Rushton" <martinrushton56 at btinternet.com>
wrote:
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Thanks Andrew.
>
> One more problem solved, as I discovered last thing yesterday there
> was a missing "[Install]".  Using your copy of the httpd service I
> cut-and-pasted it onto the end of the service file you'd given me
> earlier and at last was able to load the service.  It wouldn't run,
> but at least it was some progress.
>
> I ran systemctl daemon-reload and rebooted.
>
> It is still failing though:
>
>         # systemctl status timidity
>         timidity.service - timidity daemon
>            Loaded: loaded (/etc/systemd/system/timidity.service; enabled)
>            Active: failed (Result: exit-code) since Sat ...
>           Process: 955 ExecStop=/bin/kill -s TERM $MAINPID (code=exited,
> status=1/FAILURE)
>           Process: 790 ExecStart=/usr/bin/timidity -iAD (code=exited,
> status=0/SUCCESS)
>          Main PID: 790 (code=exited, status=0/SUCCESS)
>

<snip>

The process exited, so systemd thinks the service has exited.  You have a
'-D' option, which probably means daemonize, but you haven't set an
appropriate Type declaration in the service file.

If the service offers it, the best way to do simple services with systemd
is with *foreground* options in ExecStart.  Then set Type=simple.
STDOUT/STDERR all goes to the journal, making it easier to see what happens
if the service legitimately fails.

Take a look at packaged files in /usr/lib/systemd/system - plenty of
examples to work from.

--Pete