projects/aports·blob master · refs

30 lines · 631 B

1#!/sbin/openrc-run
2
3description="hd-idle"
4
5pidfile="/run/$RC_SVCNAME.pid"
6command="/usr/sbin/hd-idle"
7command_args="-l $LOGFILE -i 0"
8[ -n "$DISK_TYPE" ] && command_args="$command_args -c $DISK_TYPE"
9command_background=yes
10
11depend() {
12 need localmount
13 after modules
14}
15
16config_error() {
17 ebegin "Starting $description"
18 eend 1 "$1"
19}
20
21start_pre() {
22 if [ -n "$DISK" ]; then
23 case "$IDLE_TIME" in
24 *[!0123456789]* ) config_error "IDLE_TIME value is invalid" ;;
25 "" ) config_error "IDLE_TIME is not set" ;;
26 "0" ) config_error "IDLE_TIME cannot be 0" ;;
27 * ) command_args="$command_args -a $DISK -i $IDLE_TIME"
28 esac
29 fi
30}