-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathrun.sh
More file actions
executable file
·48 lines (38 loc) · 891 Bytes
/
run.sh
File metadata and controls
executable file
·48 lines (38 loc) · 891 Bytes
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
#!/usr/bin/env bash
usage() {
echo >&2 "Usage: $0 syslog_target"
exit 1
}
generate_script() {
local script_target=''
if [ -n "$SYSLOG_TARGET" ]; then
script_target=$(cat <<-EOF
\$WorkDirectory /logs/_work
\$ActionQueueType LinkedList # use asynchronous processing
\$ActionQueueFileName srvrfwd # set file name, also enables disk mode
\$ActionResumeRetryCount 1 # retries on insert failure
\$ActionQueueSaveOnShutdown on # save in-memory data if rsyslog shuts down
*.* $SYSLOG_TARGET
EOF
)
fi
printf '%s\n' "$script_target"
}
export SYSLOG_TARGET=''
export QUIET=''
while getopts 'h?' c
do
case $c in
h|?|*) usage ;;
esac
done
# Drop option args
shift "$((OPTIND-1))"
SYSLOG_TARGET=$1
shift
if [ "$1" = "--" ]; then
shift
fi
# Create the autogenerated script
generate_script > /root/script.conf
exec rsyslogd -n "$@"