diff options
Diffstat (limited to 'community/hd-idle/hd-idle.initd')
-rw-r--r-- | community/hd-idle/hd-idle.initd | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/community/hd-idle/hd-idle.initd b/community/hd-idle/hd-idle.initd new file mode 100644 index 00000000000..3e29a98708b --- /dev/null +++ b/community/hd-idle/hd-idle.initd @@ -0,0 +1,30 @@ +#!/sbin/openrc-run + +description="hd-idle" + +pidfile="/run/$RC_SVCNAME.pid" +command="/usr/sbin/hd-idle" +command_args="-l $LOGFILE -i 0" +[ -n "$DISK_TYPE" ] && command_args="$command_args -c $DISK_TYPE" +command_background=yes + +depend() { + need localmount + after modules +} + +config_error() { + ebegin "Starting $description" + eend 1 "$1" +} + +start_pre() { + if [ -n "$DISK" ]; then + case "$IDLE_TIME" in + *[!0123456789]* ) config_error "IDLE_TIME value is invalid" ;; + "" ) config_error "IDLE_TIME is not set" ;; + "0" ) config_error "IDLE_TIME cannot be 0" ;; + * ) command_args="$command_args -a $DISK -i $IDLE_TIME" + esac + fi +} |