Fix to mac address and using explicit chroot (a needed on beowulf)
[rrq/subhost.git] / startup
1 #!/bin/bash
2 #
3 # This is a script to run at startup of a bespoke sub-host
4
5 NOW=$(date +"%Y%m%d-%H%M%S")
6
7 {
8     echo "Startup at $NOW"
9     set -x
10     
11     mkdir -p /dev/pts /dev/shm /run
12     if ! grep "^none /run tmpfs" /proc/mounts ; then
13         mount -t tmpfs -osize=80M none /run
14         mount -t tmpfs -osize=20M none /dev/shm
15         mount -t devpts none /dev/pts
16         mount -t sysfs none /sys
17         mkdir -p /run/lock /run/user
18     fi
19     
20     {
21         # Restart auto interfaces
22         for IF in $(grep "^auto" /etc/network/interfaces) ; do
23             [ -e "/sys/class/net/$IF" ] || continue
24             ifdown $IF
25             ifup $IF
26         done
27     
28         # Restart services
29         SERVICES=( )
30         for S in ${SERVICES[@]} ; do
31             service $S restart
32         done
33     } &
34     NETPID=$!
35
36 } |& tee /var/log/startup-$NOW.log
37
38 exec /bin/bash