fixup of networking
[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     # Restart auto interfaces
21     for IF in $(grep "^auto" /etc/network/interfaces) ; do
22         [ "$IF" = auto ] && continue
23         ifdown $IF
24         ifup $IF
25     done
26
27     # Restart services
28     SERVICES=( )
29     for S in ${SERVICES[@]} ; do
30         service $S restart
31     done
32
33 } >& /var/log/startup-$NOW.log
34
35 exec /bin/bash