#!/bin/sh
# PROVIDE: mouse_echo
# REQUIRE: console_login

. /etc/rc.subr

name=mouse_echo
command=/usr/libexec/mouse-echo
command_args="&"
start_precmd=mouse_echo_prestart
stop_cmd=mouse_echo_stop

mouse_echo_prestart()
{
	rm -f /run/mouse-echo.term
}

mouse_echo_stop()
{
	while read pid; do
		case "$pid" in
		""|$$|$PPID) continue ;;
		esac
		kill -TERM "$pid" 2>/dev/null || :
	done < "$MOUSE_SERVICE_CGROUP/cgroup.procs"
}

run_rc_command "$1"
