Add bind-mount for /etc/adjtime to make subhost use host clock without ado
[rrq/overlay-boot.git] / subhosts.sh
1 #!/usr/bin/env /lib/init/init-d-script
2 ### BEGIN INIT INFO
3 # Provides:          subhosts
4 # Required-Start:    $syslog $time $remote_fs
5 # Required-Stop:     $syslog $time $remote_fs
6 # Default-Start:     2 3 4 5
7 # Default-Stop:      0 1 6
8 # Short-Description: Start subhosts
9 # Description:       Init script to start subhosts as per /etc/subhosts.conf
10 ### END INIT INFO
11
12 # Note that this facility only acts on start/stop/status, and it does
13 # not have any running daemon of its own. The started subhosts will
14 # "run" separately.
15
16 DAEMON=none
17 NAME=subhosts
18
19 do_status_override() {
20     pgrep -a overlay-boot | awk '{print $4}'
21 }
22
23 do_start_override() {
24     if [ -r /etc/subhosts.conf ] ; then
25         for SUB in $(grep -v '#' /etc/subhosts.conf) ; do
26             echo "overlay-boot $SUB" >&2
27             overlay-boot $SUB | logger -p boot.info -s
28         done
29     fi
30 }
31
32 do_stop_override() {
33     for SUB in $(do_status_override) ; do
34         echo "overlay-stop $SUB" >&2
35         overlay-stop $SUB | logger -p boot.info -s
36     done
37 }