new final sequence
[wyse_ntpd.git] / src / buildroot-2013.05 / custom / filesystem / etc / init.d / S99final_sequence
1 #!/bin/sh
2
3 if [ -f /fs/config/system ]
4 then
5         . /fs/config/system
6 else
7         mkdir -p /fs/config/
8 fi
9
10 mkdir /var/www/data/stats
11 chmod 777 /var/www/data/stats
12 mkdir /var/www/data/logs
13 chmod 777 /var/www/data/logs
14
15 if [ ! -f /fs/config/dropbear.tar ]
16 then
17         RD=`pwd`
18         cd /
19         tar cf /fs/config/dropbear.tar /etc/dropbear
20         cd $RD
21 fi
22
23 if [ -f /fs/config/ntp.conf ]
24 then
25         setserial /dev/ttyS0 low_latency
26         ntpd -c /fs/config/ntp.conf -x -g -N
27 fi
28
29 if [ -d /var/www/data ]
30 then
31         /opt/reboot_daemon.sh > /var/www/data/logs/reboot_daemon 2>&1 &
32         /opt/restart_ssh_daemon.sh > /var/www/data/logs/restart_ssh_daemon 2>&1 &
33         /opt/stats_daemon.sh > /var/www/data/logs/stats_daemon 2>&1 &
34 fi
35
36
37 if [ -f /fs/config/inetd.conf ]
38 then
39         /usr/sbin/inetd /fs/config/inetd.conf
40 else 
41         # this is a little silly, i should really be a little more useful with this
42 cat > /fs/config/inetd.conf << EOF
43 20010 stream tcp nowait root reboot
44 20011 stream tcp nowait root sh
45 20012 stream tcp nowait root ntpq ntpq -c lpe -n
46 20013 stream tcp nowait root ps ps -ef
47 20014 stream tcp nowait root free
48 EOF
49         /usr/sbin/inetd /fs/config/inetd.conf
50
51 fi
52
53 # work around problems with thttpd startup and its stupid stats output (which spams syslog when the time jumps too much)
54 killall -9 thttpd_wrapper
55 killall -9 thttpd
56
57 # work around dhcpd not doing the right thing
58 ifup -a
59