uci-docker-doc/src/rootfs/opt/bin/boot

18 lines
424 B
Bash
Executable File

#!/bin/sh
source /opt/core_run.env
source $LIB_DIR/runit.lib
startup
# catch shutdown signals
trap shutdown SIGTERM SIGHUP SIGQUIT SIGINT
# RUNIT is runsvdir pid
wait $RUNIT
sleep 3
echo "killing any other processes (zombie) still running in the container"
for _pid in $(ps -eo pid | grep -v PID | tr -d ' ' | grep -v '^1$' | head -n -6); do
timeout 5 /bin/sh -c "kill $_pid && wait $_pid || kill -9 $_pid"
done