NetBSD/etc/rc.d/btattach

45 lines
686 B
Bash

#!/bin/sh
#
# $NetBSD: btattach,v 1.1 2008/04/15 11:17:47 plunky Exp $
#
# PROVIDE: btattach
# REQUIRE: DAEMON
# BEFORE: bluetooth
$_rc_subr_loaded . /etc/rc.subr
name="btattach"
rcvar=${name}
required_files="/etc/bluetooth/btattach.conf"
start_cmd="btattach_start"
stop_cmd="btattach_stop"
btattach_start()
{
while read type tty speed flags; do
case ${type} in
\#*|"")
continue
;;
esac
/usr/sbin/btattach ${flags} ${type} ${tty} ${speed}
done < /etc/bluetooth/btattach.conf
}
btattach_stop()
{
pids="$(check_process btattach)"
if [ -n "${pids}" ]; then
for pid in ${pids}; do
kill $sig_stop $pid
done
fi
}
load_rc_config ${name}
run_rc_command "$1"