7b64ec27a94415501c0687cdd0d5a37efdbfed92
[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
13 if [ ! -f /fs/config/dropbear.tar ]
14 then
15         RD=`pwd`
16         cd /
17         tar cf /fs/config/dropbear.tar /etc/dropbear
18         cd $RD
19 fi
20
21 if [ -f /fs/config/ntp.conf ]
22 then
23         setserial /dev/ttyS0 low_latency
24         ntpd -c /fs/config/ntp.conf -x -g -N
25 fi
26
27 if [ -d /var/www/data ]
28 then
29
30         mknod /var/www/data/reboot p
31         chmod 644 /var/www/data/reboot
32         (echo "Rebooting..." > /var/www/data/reboot; reboot)&
33
34         mknod /var/www/data/restart_ssh p
35         chmod 644 /var/www/data/restart_ssh
36         (echo "SSH Restart" > /var/www/data/restart_ssh; /etc/init.d/S50dropbear restart)&
37
38         cldate=`date '+%d.%m.%Y'`
39         touch /var/www/data/ntp.log.$cldate
40         chmod 644 /var/www/data/ntp.log.$cldate
41
42         (sleep 30; while(true); do date '+%s' >> /var/www/data/ntp.log.$cldate; ntpq -c lpe -n |grep "127.127.20" >> /var/www/data/ntp.log.$cldate; sleep 30; done) &
43 fi
44