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

[Start]
Execute = (
	# smartd in foreground (-n), matching debian/sv/smartmontools.
	# Pause if -q onecheck fails (no devices / fatal).
	
	envfile -I /etc/default/smartmontools
	importas -sCuD "" smartd_opts smartd_opts
	
	ifelse { /usr/sbin/smartd -q onecheck } {
		exec /usr/sbin/smartd ${Args} ${smartd_opts}
	}
	s6-pause
)

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

[Environment]
Args = !-n
