diff options
Diffstat (limited to 'filesystems/dsbmd/files/dsbmd.in')
-rw-r--r-- | filesystems/dsbmd/files/dsbmd.in | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/filesystems/dsbmd/files/dsbmd.in b/filesystems/dsbmd/files/dsbmd.in new file mode 100644 index 000000000000..95eb922d3c64 --- /dev/null +++ b/filesystems/dsbmd/files/dsbmd.in @@ -0,0 +1,44 @@ +#!/bin/sh + +# PROVIDE: dsbmd +# REQUIRE: LOGIN devfs devd mountlate +# KEYWORD: shutdown +# +# Add these lines to /etc/rc.conf.local or /etc/rc.conf +# to enable this service: +# +# dsbmd_enable (bool): Set to NO by default. +# Set it to YES to enable dsbmd. +# + +. /etc/rc.subr + +name=dsbmd +command=%%PREFIX%%/libexec/dsbmd +rcvar=dsbmd_enable +pidfile=/var/run/dsbmd.pid +stop_cmd=dsbmd_stop + +load_rc_config $name + +: ${dsbmd_enable:="NO"} + +dsbmd_stop() +{ + if [ -f ${pidfile} ]; then + echo "Stopping ${name}." + pid=$(cat ${pidfile}) + n=0 + while [ $n -lt 5 ]; do + kill ${pid} 2>/dev/null || return 0 + n=$(($n + 1)) + sleep 1 + done + kill -KILL ${pid} 2>/dev/null + else + echo "${name} is not running." + return 1 + fi +} + +run_rc_command "$1" |