blob: 5ae5a62ad9eeab96ce03640f4733680d2530e6b6 (
plain)
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
|
#!/sbin/runscript
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License, v2 or later
# $Header: /var/cvsroot/gentoo-x86/app-admin/sysklogd/files/sysklogd.rc6,v 1.10 2005/02/12 00:59:21 vapier Exp $
opts="reload"
depend() {
need clock hostname
provide logger
}
start_daemon() {
local retval=0
local daemon=$1
local options=$2
[[ -z ${daemon} ]] && return 1
[[ -n ${options} ]] && options="-- ${options}"
ebegin "sysklogd -> start: ${daemon}"
start-stop-daemon --start --quiet --background \
--exec /usr/sbin/${daemon} ${options}
retval=$?
eend ${retval} "Failed to start ${daemon}"
return ${retval}
}
stop_daemon() {
local retval=0
local daemon=$1
[[ -z ${daemon} ]] && return 1
ebegin "sysklogd -> stop: ${daemon}"
# syslogd can be stubborn some times (--retry 15)...
start-stop-daemon --stop --oknodo --retry 15 \
--quiet --pidfile /var/run/${daemon}.pid
retval=$?
eend ${retval} "Failed to stop ${daemon}"
return ${retval}
}
start() {
start_daemon "syslogd" "${SYSLOGD}" || return 1
# klogd do not always start proper if started too early
sleep 1
start_daemon "klogd" "${KLOGD}" || {
if [[ -n $(pidof syslogd) ]] ; then
stop_daemon "syslogd"
fi
return 1
}
return 0
}
stop() {
stop_daemon "klogd" || return 1
# Give klogd time to stop
sleep 1
stop_daemon "syslogd" || {
if [[ -n $(pidof syslogd) ]] ; then
# Not sure if we should really try to start
# klogd again ...
start_daemon "klogd" "${KLOGD}"
fi
return 1
}
return 0
}
reload() {
local ret=0
ebegin "Reloading configuration"
killall -HUP syslogd &> /dev/null ; ret=$((ret+$?))
killall -USR2 klogd &> /dev/null ; ret=$((ret+$?))
eend ${ret}
}
|