DEV: Bump uglifyjs
[discourse_docker.git] / image / base / boot
... / ...
CommitLineData
1#!/bin/bash
2
3# we use this to boot up cause runit will not handle TERM and will not exit when done
4
5shutdown() {
6 echo Shutting Down
7 /etc/runit/3
8 ls /etc/service | SHELL=/bin/sh parallel sv force-stop {}
9 kill -HUP $RUNSVDIR
10 wait $RUNSVDIR
11
12 # give stuff a bit of time to finish
13 sleep 0.1
14
15 ORPHANS=`ps -eo pid | grep -v PID | tr -d ' ' | grep -v '^1$'`
16 SHELL=/bin/bash parallel 'timeout 5 /bin/bash -c "kill {} && wait {}" || kill -9 {}' ::: $ORPHANS 2> /dev/null
17 exit
18}
19
20/etc/runit/1 || exit $?
21/etc/runit/2&
22RUNSVDIR=$!
23echo "Started runsvdir, PID is $RUNSVDIR"
24trap shutdown SIGTERM SIGHUP
25wait $RUNSVDIR
26
27shutdown