#!/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"