#!/bin/sh ### # # FreeWLAN Addons - http://www.freewlan.info # # This Script is based on the original La Fonera Firmware version 0.7.1r2 # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, # MA 02110-1301, USA # # http://www.gnu.org/copyleft/gpl.html # ### # Antonio Ávila for Fon Technology (GPL) #crontab_file="/etc/crontabs/root" #ntp_file="/etc/config/ntpservers" #Flush previous ntp servers... #cat /etc/crontabs/root | grep -v ntp > /etc/crontabs/root #randline=$(expr `head -c1 /dev/urandom | hexdump -d | sed 's/\ //g' | sed 's/^0*//' | head -n1` % `wc -l $ntp_file | sed 's/^\ [ \t]*//' | cut -d" " -f1`) #ntpserver=$(head -n$randline $ntp_file | tail -n1) #case "$1" in # "stop") # cat $crontab_file | grep -v "ntp" > $crontab_file # crontab -l # echo stop # return # ;; # *) # ;; #esac #randminute=$(expr `head -c2 /dev/urandom | hexdump -d | sed 's/\ //g' | sed 's/^0*//' | head -n1` % 60) #randhour=$(expr `head -c2 /dev/urandom | hexdump -d | sed 's/\ //g' | sed 's/^0*//' | head -n1` % 24) #echo "$randminute $randhour * * * ntpclient -s -h $ntpserver" >> $crontab_file #ntpclient -s -h $ntpserver & #crontab -l ntpclient -s -h pool.ntp.org &