-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.d.SuSE
99 lines (94 loc) · 3.02 KB
/
init.d.SuSE
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
#! /bin/sh
#
# original Authors of /etc/init.d/syslog:
# Florian La Roche <[email protected]>, 1996
# Werner Fink <[email protected]>, 1998
#
# hacked for syslog-ng from above dudes' syslog script
# Darth Elmo <[email protected]>, 13 Sept 2001
#
# updated for OpenSuse 10 by
# Tamas Pal <[email protected]>, 3, Nov 2006
# NOTES:
#
# Add the new variable SYSLOGNG_PARAMS to /etc/rc.config. Set it equal to
# any syslog-ng startup flags/options you need (for most users it may be
# left empty, but it's good to have it there anyhow. :-)
#
# Also, if you haven't already, copy the sample syslog-ng.config
# files from $syslog-ng-source-dir/contrib and $syslog-ng-src-dir/doc
# to /etc/syslog-ng/ (you'll need to "mkdir /etc/syslog-ng" first). Editing
# one of these to meet your needs is less work than starting from scratch.
# Just make sure that one is named "syslog-ng.conf", or that you point a
# symbolic link called "syslog-ng.conf" to the one you want to use.
#
# Finally, add symbolic links to this script in /etc/rc.2, /etc/rc.3,
# and /etc/rc.5. Rename init.d/syslog to something like init.d/syslog.use-ng
# (easier than removing *its* symlinks from rc.2 et al, and easier to reenable
# should you foolishly abandon syslog-ng later on).
#
# Have a whole butt-load o' fun,
# Darth Elmo
#
# /sbin/init.d/syslog-ng
#
### BEGIN INIT INFO
# Provides: syslog-ng
# Required-Start: $network
# Required-Stop: $network
# Default-Start: 2 3 5
# Default-Stop: 0 1 6
# Description: Start the system logging daemons
### END INIT INFO
. /etc/rc.status || exit 1
NGBINDIR=/sbin
BINDIR=/sbin
test -x ${NGBINDIR}/syslog-ng || exit 0
test -x ${BINDIR}/klogd || exit 0
return=$rc_done
case "$1" in
start)
checkproc ${BINDIR}/klogd && \
killproc ${BINDIR}/klogd 2> /dev/null
checkproc ${NGBINDIR}/syslog-ng && {
killproc ${NGBINDIR}/syslog-ng 2> /dev/null
echo -n "Re-"
}
echo -n "Starting syslog-ng services"
test -z "$KERNEL_LOGLEVEL" && KERNEL_LOGLEVEL=1
startproc ${NGBINDIR}/syslog-ng $SYSLOGNG_PARAMS || return=$rc_failed
sleep 1
startproc ${BINDIR}/klogd -c $KERNEL_LOGLEVEL || return=$rc_failed
echo -e "$return"
;;
stop)
echo -n "Shutting down syslog-ng services"
killproc -TERM ${BINDIR}/klogd || return=$rc_failed
killproc -TERM ${NGBINDIR}/syslog-ng || return=$rc_failed
echo -e "$return"
;;
restart)
$0 stop && $0 start || return=$rc_failed
;;
reload)
echo -n "Reload syslog service"
killproc -TSTP ${BINDIR}/klogd || return=$rc_failed
killproc -HUP ${NGBINDIR}/syslog-ng || return=$rc_failed
killproc -CONT ${BINDIR}/klogd || return=$rc_failed
killproc -USR2 ${BINDIR}/klogd || return=$rc_failed
echo -e "$return"
;;
status)
echo -n "Checking for service syslog-ng:"
checkproc ${NGBINDIR}/syslog-ng && echo OK || echo No process
;;
probe)
test /etc/syslog-ng/syslog-ng.conf -nt /var/run/syslog-ng.pid && echo reload
;;
*)
echo "Usage: $0 {start|stop|restart|reload|probe}"
exit 1
;;
esac
test "$return" = "$rc_done" || exit 1
exit 0