Debian Codegraph @

platform/slackware/rc.rsyslogd

raw
1 #!/bin/sh
2 # Start/stop/restart the system logging daemons.
3 #
4 # Written for Slackware Linux by Patrick J. Volkerding <[email protected]>.
5 # Modded for rsyslogd by Chris Elvidge <[email protected]> Sept 2005
6 #
7
8 create_xconsole()
9 {
10 if [ ! -e /dev/xconsole ]; then
11 mknod -m 640 /dev/xconsole p
12 else
13 chmod 0640 /dev/xconsole
14 fi
15 chown 0:0 /dev/xconsole
16 }
17
18 rsyslogd_start() {
19 if [ -x /usr/sbin/rsyslogd -a -x /usr/sbin/klogd ]; then
20 echo "Starting rsyslogd / klogd daemons: "
21 # this one listens on the "usual" socket /dev/log
22 echo "/usr/sbin/rsyslogd -i $pidfile1"
23 /usr/sbin/rsyslogd -i "$pidfile1"
24 # this one listens only to the UDP port
25 sleep 1
26 echo "/usr/sbin/rsyslogd -o -r0 -f $confile2 -i $pidfile2"
27 /usr/sbin/rsyslogd -o -r0 -f "$confile2" -i "$pidfile2"
28 sleep 1 # prevent syslogd/klogd race condition on SMP kernels
29 echo "/usr/sbin/klogd -c 3 -x"
30 # '-c 3' = display level 'error' or higher messages on console
31 # '-x' = turn off broken EIP translation
32 /usr/sbin/klogd -c 3 -x
33 fi
34 }
35
36 rsyslogd_stop() {
37 killall rsyslogd 2> /dev/null
38 killall klogd 2> /dev/null
39 /usr/bin/rm pidfile1 2> /dev/null
40 /usr/bin/rm pidfile2 2> /dev/null
41 }
42
43 rsyslogd_restart() {
44 rsyslogd_stop
45 sleep 1
46 rsyslogd_start
47 }
48
49 confile1=/etc/rsyslog.conf
50 pidfile1=/var/run/rsyslogd.pid
51
52 confile2=/etc/rsyslog.udp.conf
53 pidfile2=/var/run/rsyslogd.udp.pid
54
55 case "$1" in
56 'start')
57 create_xconsole
58 rsyslogd_start
59 ;;
60 'stop')
61 rsyslogd_stop
62 ;;
63 'restart')
64 rsyslogd_restart
65 ;;
66 *)
67 echo "usage $0 start|stop|restart"
68 esac