[Main]
Type = classic
Version = 0.1.0
Description = "apcupsd daemon"
User = ( root )
Depends = ( mount-rw )
Options = ( log )

[Start]
Execute = (
	# apcupsd in foreground (-b); ISCONFIGURED gate from /etc/default/apcupsd.
	
	envfile -I /etc/default/apcupsd
	importas -uD "" ISCONFIGURED ISCONFIGURED
	
	ifelse { test "x${ISCONFIGURED}" = xyes } {
		foreground { /usr/lib/apcupsd/prestart }
		exec /usr/sbin/apcupsd ${Args}
	}
	s6-pause
)

[Logger]
RunAs = s6log
Backup = 3
MaxSize = 2000000
Timestamp = tai
Destination = /var/log/apcupsd

[Environment]
Args = !-b
