source: src-sh/pc-extractoverlay/ports-overlay/usr/local/etc/rc.d/ix_diagnose @ 90ae8ad

9.2-releasereleng/10.0releng/10.0.1releng/10.0.2releng/10.0.3releng/10.1
Last change on this file since 90ae8ad was 90ae8ad, checked in by Kris Moore <kris@…>, 16 months ago

Enable diagnostics report submission, will be used with
crash-dumps for debugging kernel panics and such

  • Property mode set to 100755
File size: 1.1 KB
Line 
1#!/bin/sh
2#
3# $FreeBSD$
4#
5
6# PROVIDE: ix_diagnose
7# REQUIRE: NETWORKING FILESYSTEMS
8# KEYWORD: nojail
9
10. /etc/rc.subr
11
12name="ix_diagnose"
13rcvar="ix_diagnose_enable"
14start_cmd="ix_diagnose_start"
15stop_cmd="ix_diagnose_stop"
16
17ix_diagnose_start()
18{
19        local _pidfile
20        local _seconds
21
22        # add /usr/local/bin for python..
23        PATH="$PATH:/usr/local/bin:/usr/local/sbin"
24        export PATH
25
26        # Check if we have sent a diag report yet
27        if [ ! -e "/var/db/ix_diag_init" ] ; then
28           (/usr/local/bin/ixinitdiag >/dev/null 2>/dev/null) &
29        fi
30
31        _pidfile=`mktemp -t ix_diagnose`
32        (
33                sh -x /usr/local/bin/ixdiagnose -b \
34                        > /tmp/ixdiagnose_boot.log 2>&1 &
35                pid=$!
36                echo $pid > $_pidfile;
37                wait
38                rm $_pidfile
39        ) &
40
41        _seconds=5
42
43        echo -n "Waiting up to $_seconds seconds for ixdiagnose to finish..."
44        (
45                while [ $_seconds -gt 0 ] ; do
46                        for i in 1 2 3 4 5 6 7 8 9 0 ; do
47                                if [ ! -e "$_pidfile" ] ; then
48                                        echo " done."
49                                        exit 1
50                                fi
51                                sleep 0.1
52                        done
53                        echo -n " $_seconds"
54                        _seconds=$(($_seconds - 1))
55                done
56                echo ". timed out.  Will proceed in the background."
57        )
58}
59
60ix_diagnose_stop()
61{
62        # nothing
63}
64
65load_rc_config $name
66run_rc_command "$1"
67
Note: See TracBrowser for help on using the repository browser.