diff --git a/server/server b/server/server index 58603f3..bb05761 100755 --- a/server/server +++ b/server/server @@ -12,7 +12,7 @@ if ($file = fopen("/home/timezoned/posixinfo", "r")) { while(!feof($file)) { $line = fgets($file); preg_match("/^(.*?) (.*?)$/", $line, $matches); - if ($matches[1] != "" && $matches[2] != "") { + if (count($matches) >= 2 && $matches[1] != "" && $matches[2] != "") { array_push($tz, array("olsen" => trim($matches[1]), "posix" => trim($matches[2]))); } } @@ -93,7 +93,7 @@ while(1) $parts = explode("#", $packet, 2); $query = $parts[0]; - $version = $parts[1]; + // $version = $parts[1]; $process = strtoupper(str_replace(" ", "_", $query)); $logstart = date("D, d M Y H:i:s") . "Z -- $remote_ip:$remote_port --"; @@ -164,3 +164,5 @@ while(1) } socket_close($sock); + +?> diff --git a/server/update b/server/update index 944614e..588c898 100755 --- a/server/update +++ b/server/update @@ -1,21 +1,34 @@ #!/bin/sh -rm -rf ~timezoned/download -mkdir ~timezoned/download +cd ~timezoned -rm -rf ~timezoned/zoneinfo -mkdir ~timezoned/zoneinfo +# Clear work environment +if [ -e "download" ]; then rm -rf download; fi +mkdir download +if [ -e "zoneinfo" ]; then rm -rf zoneinfo; fi +mkdir zoneinfo + +# Download TZ data cd ~timezoned/download wget ftp://ftp.iana.org/tz/tzdata-latest.tar.gz tar zxvf tzdata-latest.tar.gz rm tzdata-latest.tar.gz -for i in `ls`; do zic -d ~timezoned/zoneinfo $i;done -rm ~timezoned/posixinfo +# Process TZ data + +for f in `grep -l "# tzdb data" *`; do zic -d ~timezoned/zoneinfo $f; done +zic -d ~timezoned/zoneinfo backward +# POSIX info cd ~timezoned/zoneinfo + +if [ -e "posixinfo" ]; then + rm posixinfo + touch posixinfo +fi + for i in `find *|grep /` do if [ -f $i ]; then