[Unit]
Description=Zabbix Agent
After=network.target

[Service]
Type=simple
Restart=on-failure
PIDFile=<%= @pidfile %>
KillMode=control-group
ExecStart=/usr/sbin/zabbix_agentd -c <%= @agent_configfile_path %>
ExecStop=/bin/kill -SIGTERM $MAINPID
RestartSec=10s

[Install]
WantedBy=multi-user.target

[Unit]
Description=Zabbix Agent
After=network.target

[Service]
Type=simple
Restart=on-failure
<% if @pidfile %>PidFile=<%= @pidfile %><% end %>
KillMode=control-group
ExecStart=/usr/sbin/zabbix_agentd -c <%= @agent_configfile_path %>
ExecStop=/bin/kill -SIGTERM $MAINPID
RestartSec=10s

[Install]
WantedBy=multi-user.target

Make the pidfile in the systemd unit optional
Make the pidfile in the systemd unit optional

The pidfile option isn't needed always. systemd is able to automatically
determine the path to the created pidfile.
