หน้า: [1]   ลงล่าง
  พิมพ์  
ผู้เขียน หัวข้อ: ipcop - layer7 update 2009  (อ่าน 1405 ครั้ง)
chinakron และ 1 บุคคลทั่วไป กำลังดูหัวข้อนี้
sittichaip
สมาชิกร้านอินเตอร์เน็ต
***
เด็กใหม่หัดโพส
*

ความดี 15
ออฟไลน์ ออฟไลน์

กระทู้: 28


« เมื่อ: พฤศจิกายน 08, 2010, 11:52:51 AM »

ใช้งานอยู่กับ ipcop 1.4.21 , ipcop-1.4.21-kernel-2.4.36 , qos_ng_ipcop_1.4.21

เนื้อหา file l7update


#!/bin/bash
#

#modification to change the year automatically
setyear=2009
#thisyear=`date +%Y`
thisyear=2009
if [ "x$setyear" != "x$thisyear" ]
then
   sed -i -e "s/$setyear/$thisyear/g" $0
   echo -e "\nautomatically updated download-link, please start l7update again!\n"
   exit 0
fi
# end modification

if [ "x$1" != "x" -a "x$1" != "xstartup" ]
then
   MIRROR=$1
else
   MIRROR=switch
fi
cd /var/ipcop/l7filter
/var/ipcop/l7filter/wget -O "/var/ipcop/l7filter/index.html" -q "http://sourceforge.net/projects/l7-filter/files/"
currentY=$(cat localversion | cut -f1 -d"-")
currentM=$(cat localversion | cut -f2 -d"-")
currentD=$(cat localversion | cut -f3 -d"-")
currentV="$currentD$currentM$currentY"
#echo $currentV
lastY=$(cat "/var/ipcop/l7filter/index.html" |grep -B 1 l7-protocols 2>/dev/null|grep -B 0 title | sort -b -r| grep -m 1 "2009-" 2>/dev/null|cut -d- -f5 2>/dev/null)
lastM=$(cat "/var/ipcop/l7filter/index.html" |grep -B 1 l7-protocols 2>/dev/null|grep -B 0 title | sort -b -r| grep -m 1 "2009-" 2>/dev/null|cut -d- -f6 2>/dev/null)
lastD=$(cat "/var/ipcop/l7filter/index.html" |grep -B 1 l7-protocols 2>/dev/null|grep -B 0 title | sort -b -r| grep -m 1 "2009-" 2>/dev/null|cut -d- -f7|cut -d. -f1 2>/dev/null)
lastV="$lastD$lastM$lastY"
lastupdate="$lastY-$lastM-$lastD"
#echo $lastupdate
[ "$lastV" == "" ] && echo -e "Unable to detect online Version, exiting..........." && exit 1
[ "$currentV" == "" ] && echo -e "Unable to detect installed Version, exiting..........." && exit 1
/bin/rm index.html
if [ "$lastV" != "$currentV" ]
then
    CHECK=`/var/ipcop/l7filter/wget --spider http://$MIRROR.dl.sourceforge.net/project/l7-filter/Protocol%20definitions/"$lastupdate"/l7-protocols-"$lastupdate".tar.gz 2>&1`
    #echo $CHECK
    SIZE=`/bin/echo $CHECK| cut -dL -f2| awk {'print $2'}|cut -d, -f1`
    NOTFOUND=`/bin/echo $SIZE|grep http`
    NOTFOUND="x${NOTFOUND}"
    FAILED=`/bin/echo $CHECK| grep failed| cut -d: -f6`
    FAILED="x${FAILED}"
    #echo $SIZE
   #echo;echo;echo
    #echo $NOTFOUND
   #echo;echo;echo
    #echo $FAILED
    if [ "$FAILED" != "x" ]
    then
    if [ "x$1" != "xstartup" ]
    then
           /bin/echo "Error while downloading file."
           exit 0
    else
      /bin/echo -e "[\033[1;31m Failed \033[0m]"
      exit 0
    fi
    fi   
    if [ "$NOTFOUND" != "x" ]
    then
    if [ "x$1" != "xstartup" ]
    then
          /bin/echo "File is not on the mirror right now."
          exit 0
    else
      /bin/echo -e "[\033[1;31m Failed \033[0m]"
      exit 0
    fi
    fi   
    if [ $SIZE -le 2 ]
    then
    if [ "x$1" != "xstartup" ]
    then
          /bin/echo "File is not on the mirror right now."
          exit 0
    else
      /bin/echo -e "[\033[1;31m Failed \033[0m]"
      exit 0
    fi
    fi
    /var/ipcop/l7filter/wget -q http://$MIRROR.dl.sourceforge.net/project/l7-filter/Protocol%20definitions/"$lastupdate"/l7-protocols-"$lastupdate".tar.gz
    /bin/echo $lastupdate > localversion
    /bin/tar xfz l7-protocols-"$lastupdate".tar.gz
    /bin/rm -rf /etc/l7-protocols/
    /bin/mv l7-protocols-"$lastupdate" /etc/l7-protocols
    /bin/chown -R root.root /etc/l7-protocols
    /bin/rm l7-protocols-"$lastupdate".tar.gz
    /bin/echo "$(date) : Layer7 protocols updated successefully" >>/var/log/messages
    if [ "x$1" == "xstartup" ]
    then
      echo -e "[\033[1;32m Done \033[0m]"
    fi
else
    /bin/echo "$(date) : Your Layer7 protocols are up to date" >>/var/log/messages
    if [ "x$1" == "xstartup" ]
    then
      echo -e "[\033[1;32m Done \033[0m]"
    fi
fi
บันทึกการเข้า
sittichaip
สมาชิกร้านอินเตอร์เน็ต
***
เด็กใหม่หัดโพส
*

ความดี 15
ออฟไลน์ ออฟไลน์

กระทู้: 28


« ตอบ #1 เมื่อ: ธันวาคม 16, 2010, 08:10:58 PM »

#Update 4/12/2010

#!/bin/bash
#
#modification to change the year automatically
setyear=2009
#thisyear=`date +%Y`
thisyear=2009
if [ "x$setyear" != "x$thisyear" ]
then
   sed -i -e "s/$setyear/$thisyear/g" $0
   echo -e "\nautomatically updated download-link, please start l7update again!\n"
   exit 0
fi
# end modification

if [ "x$1" != "x" -a "x$1" != "xstartup" ]
then
   MIRROR=$1
else
   MIRROR=switch
fi
cd /var/ipcop/l7filter
/var/ipcop/l7filter/wget -O "/var/ipcop/l7filter/index.html" -q "http://sourceforge.net/projects/l7-filter/files/Protocol%20definitions/2009-05-28/"
currentY=$(cat localversion | cut -f1 -d"-")
currentM=$(cat localversion | cut -f2 -d"-")
currentD=$(cat localversion | cut -f3 -d"-")
currentV="$currentD$currentM$currentY"
echo $currentV
lastY=$(cat "/var/ipcop/l7filter/index.html" |grep -B 1 l7-protocols 2>/dev/null|grep -B 0 title | sort -b -r| grep -m 1 "2009-" 2>/dev/null|cut -d- -f3 2>/dev/null)
lastM=$(cat "/var/ipcop/l7filter/index.html" |grep -B 1 l7-protocols 2>/dev/null|grep -B 0 title | sort -b -r| grep -m 1 "2009-" 2>/dev/null|cut -d- -f4 2>/dev/null)
lastD=$(cat "/var/ipcop/l7filter/index.html" |grep -B 1 l7-protocols 2>/dev/null|grep -B 0 title | sort -b -r| grep -m 1 "2009-" 2>/dev/null|cut -d- -f5|cut -d. -f1 2>/dev/null)
lastV="$lastD$lastM$lastY"
lastupdate="$lastY-$lastM-$lastD"
echo $lastupdate
[ "$lastV" == "" ] && echo -e "Unable to detect online Version, exiting..........." && exit 1
[ "$currentV" == "" ] && echo -e "Unable to detect installed Version, exiting..........." && exit 1
/bin/rm index.html
if [ "$lastV" != "$currentV" ]
then
    CHECK=`/var/ipcop/l7filter/wget --spider http://$MIRROR.dl.sourceforge.net/project/l7-filter/Protocol%20definitions/"$lastupdate"/l7-protocols-"$lastupdate".tar.gz 2>&1`
    #echo $CHECK
    SIZE=`/bin/echo $CHECK| cut -dL -f2| awk {'print $2'}|cut -d, -f1`
    NOTFOUND=`/bin/echo $SIZE|grep http`
    NOTFOUND="x${NOTFOUND}"
    FAILED=`/bin/echo $CHECK| grep failed| cut -d: -f6`
    FAILED="x${FAILED}"
    #echo $SIZE
   #echo;echo;echo
    #echo $NOTFOUND
   #echo;echo;echo
    #echo $FAILED
    if [ "$FAILED" != "x" ]
    then
    if [ "x$1" != "xstartup" ]
    then
           /bin/echo "Error while downloading file."
           exit 0
    else
      /bin/echo -e "[\033[1;31m Failed \033[0m]"
      exit 0
    fi
    fi   
    if [ "$NOTFOUND" != "x" ]
    then
    if [ "x$1" != "xstartup" ]
    then
          /bin/echo "File is not on the mirror right now."
          exit 0
    else
      /bin/echo -e "[\033[1;31m Failed \033[0m]"
      exit 0
    fi
    fi   
    if [ $SIZE -le 2 ]
    then
    if [ "x$1" != "xstartup" ]
    then
          /bin/echo "File is not on the mirror right now."
          exit 0
    else
      /bin/echo -e "[\033[1;31m Failed \033[0m]"
      exit 0
    fi
    fi
    /var/ipcop/l7filter/wget -q http://$MIRROR.dl.sourceforge.net/project/l7-filter/Protocol%20definitions/"$lastupdate"/l7-protocols-"$lastupdate".tar.gz
    /bin/echo $lastupdate > localversion
    /bin/tar xfz l7-protocols-"$lastupdate".tar.gz
    /bin/rm -rf /etc/l7-protocols/
    /bin/mv l7-protocols-"$lastupdate" /etc/l7-protocols
    /bin/chown -R root.root /etc/l7-protocols
    /bin/rm l7-protocols-"$lastupdate".tar.gz
    /bin/echo "$(date) : Layer7 protocols updated successefully" >>/var/log/messages
    if [ "x$1" == "xstartup" ]
    then
      echo -e "[\033[1;32m Done \033[0m]"
    fi
else
    /bin/echo "$(date) : Your Layer7 protocols are up to date" >>/var/log/messages
    if [ "x$1" == "xstartup" ]
    then
      echo -e "[\033[1;32m Done \033[0m]"
    fi
fi
บันทึกการเข้า
sittichaip
สมาชิกร้านอินเตอร์เน็ต
***
เด็กใหม่หัดโพส
*

ความดี 15
ออฟไลน์ ออฟไลน์

กระทู้: 28


« ตอบ #2 เมื่อ: กุมภาพันธ์ 21, 2011, 04:59:38 PM »

#update  21/02/2010

#!/bin/bash
#
#modification to change the year automatically
setyear=2010
#thisyear=`date +%Y`
thisyear=2010
if [ "x$setyear" != "x$thisyear" ]
then
   sed -i -e "s/$setyear/$thisyear/g" $0
   echo -e "\nautomatically updated download-link, please start l7update again!\n"
   exit 0
fi
# end modification

if [ "x$1" != "x" -a "x$1" != "xstartup" ]
then
   MIRROR=$1
else
   MIRROR=ncu
fi
cd /var/ipcop/l7filter
/var/ipcop/l7filter/wget -O "/var/ipcop/l7filter/index.html" "http://sourceforge.net/projects/l7-filter/files/Protocol%20definitions/2009-05-28/"
currentY=$(cat localversion | cut -f1 -d"-")
currentM=$(cat localversion | cut -f2 -d"-")
currentD=$(cat localversion | cut -f3 -d"-")
currentV="$currentD$currentM$currentY"
echo $currentV
lastY=$(cat "/var/ipcop/l7filter/index.html" |grep -B 1 l7-protocols 2>/dev/null|grep -B 0 title | sort -b -r| grep -m 1 "2009-" 2>/dev/null|cut -d- -f3 2>/dev/null)
lastM=$(cat "/var/ipcop/l7filter/index.html" |grep -B 1 l7-protocols 2>/dev/null|grep -B 0 title | sort -b -r| grep -m 1 "2009-" 2>/dev/null|cut -d- -f4 2>/dev/null)
lastD=$(cat "/var/ipcop/l7filter/index.html" |grep -B 1 l7-protocols 2>/dev/null|grep -B 0 title | sort -b -r| grep -m 1 "2009-" 2>/dev/null|cut -d- -f5|cut -d. -f1 2>/dev/null)
lastV="$lastD$lastM$lastY"
lastupdate="$lastY-$lastM-$lastD"
echo $lastupdate
[ "$lastV" == "" ] && echo -e "Unable to detect online Version, exiting..........." && exit 1
[ "$currentV" == "" ] && echo -e "Unable to detect installed Version, exiting..........." && exit 1
/bin/rm index.html
if [ "$lastV" != "$currentV" ]
then
    CHECK=`/var/ipcop/l7filter/wget --spider http://$MIRROR.dl.sourceforge.net/project/l7-filter/Protocol%20definitions/"$lastupdate"/l7-protocols-"$lastupdate".tar.gz 2>&1`
    echo $CHECK
    SIZE=`/bin/echo $CHECK| cut -dL -f2| awk {'print $2'}|cut -d, -f1`
    NOTFOUND=`/bin/echo $SIZE|grep http`
    NOTFOUND="x${NOTFOUND}"
    FAILED=`/bin/echo $CHECK| grep failed| cut -d: -f6`
    FAILED="x${FAILED}"
    echo $SIZE
   #echo;echo;echo
    echo $NOTFOUND
   #echo;echo;echo
    echo $FAILED
    if [ "$FAILED" != "x" ]
    then
    if [ "x$1" != "xstartup" ]
    then
           /bin/echo "Error while downloading file."
           exit 0
    else
      /bin/echo -e "[\033[1;31m Failed \033[0m]"
      exit 0
    fi
    fi   
    if [ "$NOTFOUND" != "x" ]
    then
    if [ "x$1" != "xstartup" ]
    then
          /bin/echo "File is not on the mirror right now."
          exit 0
    else
      /bin/echo -e "[\033[1;31m Failed \033[0m]"
      exit 0
    fi
    fi   
    if [ $SIZE -le 2 ]
    then
    if [ "x$1" != "xstartup" ]
    then
          /bin/echo "File is not on the mirror right now."
          exit 0
    else
      /bin/echo -e "[\033[1;31m Failed \033[0m]"
      exit 0
    fi
    fi
    /var/ipcop/l7filter/wget http://$MIRROR.dl.sourceforge.net/project/l7-filter/Protocol%20definitions/"$lastupdate"/l7-protocols-"$lastupdate".tar.gz
    /bin/echo $lastupdate > localversion
    /bin/tar xfz l7-protocols-"$lastupdate".tar.gz
    /bin/rm -rf /etc/l7-protocols/
    /bin/mv l7-protocols-"$lastupdate" /etc/l7-protocols
    /bin/chown -R root.root /etc/l7-protocols
    /bin/rm l7-protocols-"$lastupdate".tar.gz
    /bin/echo "$(date) : Layer7 protocols updated successefully" >>/var/log/messages
    if [ "x$1" == "xstartup" ]
    then
      echo -e "[\033[1;32m Done \033[0m]"
    fi
else
    /bin/echo "$(date) : Your Layer7 protocols are up to date" >>/var/log/messages
    if [ "x$1" == "xstartup" ]
    then
      echo -e "[\033[1;32m Done \033[0m]"
    fi
fi
บันทึกการเข้า
หน้า: [1]   ขึ้นบน
  พิมพ์  
 
กระโดดไป:  


ติดต่อโฆษณา สำหรับบริษัท หรือท่านใดที่ต้องการทำกิจกรรมร่วมกับเว็บไซต์ ICT.in.th ติดต่อได้ที่ ictnetcafe@gmail.com

ข้อความ หรือรูปภาพที่ปรากฏในเว็บไซต์แห่งนี้ เกิดจากการเขียนโดยสาธารณชน และถูกส่งขึ้นโดยอัตโนมัติจากบุคคลทั่วไป ซึ่งทาง ICT.in.th มิได้มีส่วนร่วมรู้เห็น ตรวจสอบ หรือพิสูจน์ข้อเท็จจริงใดๆ ทั้งสิ้น ผู้อ่านจึงควรใช้วิจารณญาณในการรับข่าวสารข้อมูล หากท่านพบเห็นข้อความ หรือรูปภาพที่ไม่เหมาะสม กรุณาแจ้งให้ทีมงานทราบ เพื่อดำเนินการต่อไป

Tags: จับลิขสิทธิ์ บ่อนออนไลน์ internetcafe รายได้เสริมร้านเน็ต ชมรมร้านเกมส์ ร้านเน็ตคาเฟ่ เปิด ร้าน เน็ต คาเฟ่ เกมออนไลน์ใหม่ แนะนำ ร้าน เน็ต คาเฟ่ หมานำจับ เข้า youtube ไม่ได้ เข้า msn ไม่ได้ แทงกันในร้านเกม เปิดร้านเน็ต ลิขสิทธิ์ ตารางผสมของ dota 6.73 ตารางออกของdota 6.73 ผสมของdotaใหม่ล่าสุด map dota 6.74 ผสมของ dota 6.73 internet cafe โปรแกรม เน็ต คาเฟ่ หูฟังดังข้างเดียว พ.ร.บ.ภาพยนตร์และวีดิทัศน์ กลุ่มร้านเน็ต 6.73 มีอะไรใหม่ ร้านอินเทอร์เน็ตสีขาว สมาคมร้านอินเตอร์เน็ต ลิขสิทธิ์ร้านเกมส์ กลุ่มเครือข่ายร้านเน็ต เกมส์ออนไลน์ทั้งหมด dota 6.74 มีอะไรใหม่ สมัครเน็ตคาเฟ่ เกมส์ออนไลน์ฟรี hon lan ยังไง icct ict ตลาดอินเตอร์เน็ต seo คอนแทคเลนส์