capture.sh.in 1.93 KB
Newer Older
1 2 3
#!/bin/sh

# PROVIDE: capture
4
# REQUIRE: DAEMON testbed
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
# BEFORE: LOGIN
# KEYWORD: shutdown

#
# Start up capture processes.
#
# XXX if you notice that each capture is being started up twice on reboot.
# then you need to make sure that the "local_startup" path in /etc/rc.conf
# (or /etc/defaults/rc.conf) does not include /usr/X11R6/etc/rc.d.
# In FreeBSD 6 and above, /usr/X11R6 is a symlink to /usr/local and the
# result is that scripts in /usr/local/etc/rc.d wind up being called twice.
# This is okay for scripts that fully use the FreeBSD rc system, but since
# this script is "not quite conforming" it causes captures to be started
# twice. You may need to override local_startup in /etc/rc.conf to avoid this.
#

. /etc/rc.subr

bindir=@prefix@/sbin
if [ ! -x $bindir/capture ]; then
    echo "*** capture.sh: $bindir/capture not installed"
    exit 1
fi

case "$1" in
30
start|faststart|quietstart|onestart|forcestart)
31
    echo -n ' capture'
32
    ;;
33
restart|fastrestart|quietrestart|onerestart|forcerestart)
34 35
    killall capture
    ;;
36
stop|faststop|quietstop|onestop|forcestop)
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
    killall capture && echo -n ' capture'
    exit 0
    ;;
*)
    echo "Usage: $0 {start|stop|restart}" >&2
    exit 1
    ;;
esac

#
# run_capture contains the actual capture start lines that look like:
#
#   $bindir/capture -T 15 -r -s [baudrate] [device] [ttyport] >/dev/null 2>&1 &
#
# The -T option gives the idle timestamp interval; i.e., if output on the
# device occurs, and it has been more than <interval> seconds since the last
# output, a timestamp is output to the log before the current output.
# This helps identify long gaps between output in the logfile and effectively
# time stamps "blocks" of output in the log.
#
# You should put a "sleep 1" in after every 1-20 lines to avoid overload
# (since these are all background startups).
#
# XXX run_capture should be auto-generated.
#
if [ -x $bindir/run_capture ]; then
    $bindir/run_capture $bindir/capture
fi

exit $?