blob: 19a7229a9c3110fe8c50c9a1cf272f65e231c9de (
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
|
#!/bin/sh
# Triggered by initqueue/online and starts rsyslogd with bootparameters
type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh
# prevent starting again if already running
if [ -f /var/run/syslogd.pid ]; then
read -r pid < /var/run/syslogd.pid
kill -0 "$pid" && exit 0
fi
rsyslog_config() {
local server="$1"
shift
local syslog_template="$1"
shift
local filters="$*"
local filter=
cat "$syslog_template"
(
# disable shell expansion / globbing
# since filters contain such characters
set -f
for filter in $filters; do
echo "${filter} @${server}"
done
)
#echo "*.* /tmp/syslog"
}
[ -f /tmp/syslog.type ] && read -r type < /tmp/syslog.type
[ -f /tmp/syslog.server ] && read -r server < /tmp/syslog.server
[ -f /tmp/syslog.filters ] && read -r filters < /tmp/syslog.filters
[ -z "$filters" ] && filters="kern.*"
[ -f /tmp/syslog.conf ] && read -r conf < /tmp/syslog.conf
[ -z "$conf" ] && conf="/etc/rsyslog.conf" && echo "$conf" > /tmp/syslog.conf
if [ "$type" = "rsyslogd" ]; then
template=/etc/templates/rsyslog.conf
if [ -n "$server" ]; then
rsyslog_config "$server" "$template" "$filters" > "$conf"
rsyslogd -c3
fi
fi
|