#!/usr/bin/execlineb -P

# Debian ships /usr/lib/tmpfiles.d/zabbix-agent.conf with
#   d /run/zabbix 0755 zabbix zabbix
# and the shipped /etc/zabbix/zabbix_agentd.conf has
#   PidFile=/run/zabbix/zabbix_agentd.pid
# s6 has no tmpfiles.d handling, and run-script-daemon only creates
# /run/$(basename $DAEMON) = /run/zabbix_agentd. On a system that does not
# carry /run/zabbix over from its image, zabbix_agentd cannot write its pid
# file and dies right after the spawn -- while svctl isup still reports
# "running" (see .permafail).
if { mkdir -p /run/zabbix }
if { chown zabbix:zabbix /run/zabbix }
if { chmod 0755 /run/zabbix }
run-script-daemon zabbix-agent
