I have a systemd service (for heka) which causes me some headaches.
The problem is that "start" returns successfully even if the heka daemon dies shortly after starting. This is happening if the configuration files are wrong, for example: the process will start, it will verify the configuration and die if it's not happy about what it finds. Systemd returns successfully in this case.
Is there any way to force systemd to check the program status after it is initializing? Maybe to sleep n seconds after the process has started?
This is the script:
[Unit]
Description=Heka event/metric/log collection and routing daemon
After=network.target auditd.service
ConditionPathExists=!/etc/heka/hekad_not_to_be_run
[Service]
EnvironmentFile=-/etc/default/heka
Type=simple
PIDFile=/var/run/hekad.pid
ExecStart=/usr/bin/hekad -config=/etc/heka
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
Restart=on-failure
StandardError=inherit
[Install]
WantedBy=multi-user.target
Alias=heka.service