# Example: daemon with a companion stop script.
#
# Some services need an explicit shutdown sequence rather than just
# being signaled. The [exec].stop field references a script in the
# same directory. zyginit runs it with a stop timeout (default 60s)
# before falling back to SIGKILL.
[service]
type = "daemon"
description = "Database daemon with graceful shutdown"
[exec]
start = "./start.sh"
stop = "./stop.sh"
user = "dbuser"
[stop]
# How long zyginit waits for stop.sh to finish before escalating
# to SIGKILL. Default is 60 seconds.
timeout = 30
#!/bin/sh
# Start the database, foregrounded so zyginit can supervise it directly.
exec /usr/sbin/example-dbd --foreground --config /etc/example-db.conf
#!/bin/sh
# Graceful shutdown: tell the daemon to flush and exit cleanly.
exec example-dbctl --shutdown --wait