File: solaris.startup

package info (click to toggle)
sec 2.8.3-2
  • links: PTS
  • area: main
  • in suites: bullseye
  • size: 788 kB
  • sloc: perl: 8,700; sh: 284; ansic: 135; makefile: 2
file content (131 lines) | stat: -rw-r--r-- 2,550 bytes parent folder | download | duplicates (7)
1
2
3
4
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
30
31
32
33
34
35
36
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
#!/bin/bash
#
# /etc/rc3.d/S98sec
#
# Modified start up script for Solaris (contributed by Jason Chambers)
# Added the different SIGs to script

STARTCFG=/usr/local/etc/sec/sec.start
SEC=/usr/local/bin/sec
SECPID=/var/run/sec.pid

RETVAL=0

start() {
        echo -n "Starting up Syslog Event Correlator: "
        while read command
        do
                command=`echo $command | sed -e "s/\#.*//" -e "s/^  *//" -e 's/  *$//' -e '/^$/d'`
                if [ ! -z "$command" ] ; then
                        $SEC $command
                        RETVAL=$(( $? + RETVAL ))
                fi
        done < $STARTCFG

        if [ $RETVAL -eq 0 ] ; then
                echo
        else
                echo "Failure starting SEC"
                echo
        fi
}

stop() {
        echo -n "Shutting down sec: "
    # SIGTERM
        /bin/kill -15 `/bin/cat $SECPID`
        RETVAL=$?

        if [ $RETVAL -eq 0 ] ; then
                echo
        else
                echo "Failed to shutdown SEC"
                echo
        fi
}

killme() {
    echo -n "restart SEC completely, all variables and contexts will be 
deleted"
    # SIGHUP
    /bin/kill -1 `/bin/cat $SECPID`
    RETVAL=$?

        if [ $RETVAL -eq 0 ] ; then
                echo
        else
                echo "Failed to reloading SEC"
                echo
        fi
}


reload() {
    echo -n "Re-reading config file, all variables and contexts will not 
be deleted"
    # SIGABRT
    /bin/kill -6 `/bin/cat $SECPID`
    RETVAL=$?

        if [ $RETVAL -eq 0 ] ; then
                echo
        else
                echo "Failed to reloading SEC"
                echo
        fi
}

dump() {
    echo -n "Dumping stats to $DUMPFILE"
    # SIGUSR1
    /bin/kill -16 `/bin/cat $SECPID`
    RETVAL=$?

        if [ $RETVAL -eq 0 ] ; then
                echo
        else
                echo "Failed dumping stats"
                echo
        fi
}

logrotate() {
    echo -n "re-opening my logfile"
    # SIGUSR2   
    /bin/kill -17 `/bin/cat $SECPID`
    RETVAL=$?

        if [ $RETVAL -eq 0 ] ; then
                echo
        else
                echo "Failed re-opening log file"
                echo
        fi
}

# See how we were called.
case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  killme)
        killme
        ;;
  reload)
        reload
        ;;
  dump)
        dump
        ;;
  logrotate)
    logrotate
    ;;
  *)
        echo "Usage: sec {start|stop|reload|dump|logrotate}"
        exit 1
esac

exit $RETVAL