mirror of
https://github.com/linuxkit/linuxkit.git
synced 2026-01-05 23:35:49 +00:00
Adds a logging daemon that collects logs in a ring buffer in a runc container. The tools logwrite and logread can be used to read/write logs. The logging daemon can be sent open file descriptors that will be read and included in the logs. Modifies init to start the daemon and use logwrite to capture logs from runc. Signed-off-by: Magnus Skjegstad <magnus@skjegstad.com>
37 lines
948 B
Bash
Executable File
37 lines
948 B
Bash
Executable File
#!/bin/sh
|
|
|
|
# start memlogd container
|
|
|
|
/usr/bin/startmemlogd
|
|
|
|
# start onboot containers, run to completion
|
|
|
|
if [ -d /containers/onboot ]
|
|
then
|
|
for f in $(find /containers/onboot -mindepth 1 -maxdepth 1 | sort)
|
|
do
|
|
base="$(basename $f)"
|
|
/bin/mount --bind "$f/rootfs" "$f/rootfs"
|
|
mount -o remount,rw "$f/rootfs"
|
|
/usr/bin/logwrite -n "$(basename $f)" /usr/bin/runc run --bundle "$f" "$(basename $f)"
|
|
printf " - $base\n"
|
|
done
|
|
fi
|
|
|
|
# start service containers
|
|
|
|
if [ -d /containers/services ]
|
|
then
|
|
for f in $(find /containers/services -mindepth 1 -maxdepth 1 | sort)
|
|
do
|
|
base="$(basename $f)"
|
|
/bin/mount --bind "$f/rootfs" "$f/rootfs"
|
|
mount -o remount,rw "$f/rootfs"
|
|
log="/var/log/$base.log"
|
|
/usr/bin/logwrite -n "$(basename $f)" /sbin/start-stop-daemon --start --pidfile /run/$base.pid --exec /usr/bin/runc -- run --bundle "$f" --pid-file /run/$base.pid "$(basename $f)" </dev/null 2>$log >$log &
|
|
printf " - $base\n"
|
|
done
|
|
fi
|
|
|
|
wait
|