#!/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 }
# Bereitschaft: agent.ping ueber 127.0.0.1 antwortet 1 (data/check),
# gemeldet von s6-notifyoncheck, alle 1 s bis 60 s.
s6-notifyoncheck -d -w 1000 -n 60 --
run-script-daemon zabbix-agent
