-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathentrypoint.sh
More file actions
43 lines (35 loc) · 847 Bytes
/
Copy pathentrypoint.sh
File metadata and controls
43 lines (35 loc) · 847 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
#!/bin/sh
set -eu
mkdir -p /logs
chmod -R a+rX /logs
setfacl -R -m o::rX /logs
setfacl -m d:o::rx /logs
umask 0000
term_handler() {
if [ "${rsyslog_pid:-}" ]; then
kill "$rsyslog_pid" 2>/dev/null || true
fi
if [ "${web_pid:-}" ]; then
kill "$web_pid" 2>/dev/null || true
fi
}
trap 'term_handler; wait 2>/dev/null || true; exit 0' INT TERM
rsyslogd -n &
rsyslog_pid=$!
/usr/local/bin/syslog-flow &
web_pid=$!
while :; do
if ! kill -0 "$rsyslog_pid" 2>/dev/null; then
wait "$rsyslog_pid" || status=$?
kill "$web_pid" 2>/dev/null || true
wait "$web_pid" 2>/dev/null || true
exit "${status:-1}"
fi
if ! kill -0 "$web_pid" 2>/dev/null; then
wait "$web_pid" || status=$?
kill "$rsyslog_pid" 2>/dev/null || true
wait "$rsyslog_pid" 2>/dev/null || true
exit "${status:-1}"
fi
sleep 1
done