Top > 日記 > 2011-12-31

G2toG1移行スクリプト

現在は、urcallに個人コールだった場合は全て、10分間、G1に移行してしまうため、G1からG2に戻るまでの約10分間は、G2側に接続できない。
そこで改善策を検討。※つまりG1移行の条件付けをする

  1. urcall が"J" または"7" で始まる局、尚且つ、RPT1/RPT2がG1レピーター*1であり、RTP2の末尾文字が"G"の場合にG1へ移行する。
  2. dplusのヘッダー例
    "type=XX"のXX桁数により、切り取る位置が異なる。
    0x0000:  4500 00d9 0000 4000 4011 7c11 0a00 0002  E.....@.@.|.....
    0x0010:  4016 73eb 4e21 4e22 00c5 bed9 bdc0 1000  @.s.N!N"........
    0x0020:  6470 6c75 7320 322e 3267 3a67 7763 616c  dplus.2.2g:gwcal
    0x0030:  6c3d 4a50 3159 4a51 2020 3a74 696d 653d  l=JP1YJQ..:time=
    0x0040:  3133 3235 3331 3533 3033 2e37 3837 3232  1325315303.78722
    0x0050:  323a 7479 7065 3d31 363a 6d6f 6475 6c65  2:type=16:module
    0x0060:  6964 3d30 313a 7374 7265 616d 6964 3d64  id=01:streamid=d
    0x0070:  6665 303a 6d79 6361 6c6c 3d4a 4831 424c  fe0:mycall=JH1BL
    0x0080:  5420 4e3a 6d79 7375 6666 6978 3d44 5641  T.N:mysuffix=DVA
    0x0090:  503a 7572 6361 6c6c 3d43 5143 5143 5120  P:urcall=CQCQCQ.
    0x00a0:  203a 7270 7431 3d4a 4831 424c 5420 4e3a  .:rpt1=JH1BLT.N:
    0x00b0:  7270 7432 3d52 4546 3030 3820 423a 6d73  rpt2=REF008.B:ms
    0x00c0:  673d 6777 6c69 6e6b 2076 2f64 2065 6e64  g=gwlink.v/d.end
    0x00d0:  2031 343a 6470 6c75 73                   .14:dplus
    -------------------------------------------------------------------
    0x0000:  4500 00d2 0000 4000 4011 7c18 0a00 0002  E.....@.@.|.....
    0x0010:  4016 73eb 4e21 4e22 00be bed2 b6c0 1000  @.s.N!N"........
    0x0020:  6470 6c75 7320 322e 3267 3a67 7763 616c  dplus.2.2g:gwcal
    0x0030:  6c3d 4a50 3159 4a51 2020 3a74 696d 653d  l=JP1YJQ..:time=
    0x0040:  3133 3235 3331 3437 3134 2e30 3833 3337  1325314714.08337
    0x0050:  323a 7479 7065 3d32 3a6d 6f64 756c 6569  2:type=2:modulei
    0x0060:  643d 3030 3a73 7472 6561 6d69 643d 3030  d=00:streamid=00
    0x0070:  3030 3a6d 7963 616c 6c3d 4a47 3156 574c  00:mycall=JH1BLT
    0x0080:  2020 3a6d 7973 7566 6669 783d 2020 2020  ..:mysuffix=....
    0x0090:  3a75 7263 616c 6c3d 2020 2020 2020 2020  :urcall=........
    0x00a0:  3a72 7074 313d 4a50 3159 4a51 2041 3a72  :rpt1=JP1YJQ.A:r
    0x00b0:  7074 323d 2020 2020 2020 2020 3a6d 7367  pt2=........:msg
    0x00c0:  3d55 7365 7220 7570 6461 7465 3a64 706c  =User.update:dpl
    0x00d0:  7573                                     us
    
  3. g2g1_grep.sh (2011 12/30 )
    #!/bin/bash
    
    while :
    do
    FLAG=`/usr/sbin/tcpdump -vv dst host xx.xx.xxx.xxx -nXs 800 -c 1`
    echo "$FLAG"
    DISCO=`echo "$FLAG" | grep -e "disconne"`
    URCALL=`echo "$FLAG" | grep -e "urcall" | cut -b60-69`
    TYPE=`echo "$FLAG" | grep -e "type" | cut -b62-67`
    echo "$TYPE"
    if test "$DISCO" = "" && test "$URCALL" = "........"; then
      date >> log01
      if test $TYPE = "odulei" ; then
        MYCALL=`echo "$FLAG" | grep -e "mycall" | cut -b62-67`
        URCALL=`echo "$FLAG" | grep -e "urcall" | cut -b60-69`
        RPT1=`echo "$FLAG" | grep -e "pt1=" | cut -b58-65`
        RPT2=`echo "$FLAG" | grep -e "pt2=" | cut -b56-63`
      fi
      if test $TYPE = "module" ; then
        MYCALL=`echo "$FLAG" | grep -e "mycall" | cut -b63-68`
        URCALL=`echo "$FLAG" | grep -e "urcall" | cut -b61-68`
        RPT1=`echo "$FLAG" | grep -e "pt1=" | cut -b59-66`
        RPT2=`echo "$FLAG" | grep -e "pt2=" | cut -b57-64`
      fi
      date; echo "$MYCALL"; echo "$URCALL"; echo "$RPT1"; echo "$RPT2"
      DT=`date`
      echo $DT $MYCALL $URCALL $RPT1 $RPT2 >>trace.log
      H_UR=`echo "$URCALL" | cut -b1`
      C_RPT1=`echo "$RPT1" | cut -b1-6`
      C_RPT2=`echo "$RPT2" | cut -b1-6`
      E_RPT2=`echo "$RPT2" | cut -b8`
      RPT1_G1=`grep $C_RPT1 /root/G1_rpt.txt`
      RPT2_G1=`grep $C_RPT2 /root/G1_rpt.txt`
      if (test "$H_UR" = "J" || test "$H_UR" = "7") && test "$RPT1_G1" != "" && test "$RPT2_G1 " != "" && test "$E_RPT2" = "G"; then
        echo "going to G1"; echo "to G1" >>trace.log
    
        pkill -9 tcpdump
        chkconfig --level 2 dstar_gw off
        /etc/init.d/dstar_gw stop
        /etc/init.d/dplus stop
    
        if [ -f /dstar/dsgwd/dsgwd2 ]; then
           mv /dstar/dsgwd/dsgwd2 /dstar/dsgwd/dsgwd
        fi
    
        sleep 10
    
        /dstar/exec-gw
    
        sleep 600
    
        if [ -f /dstar/dsgwd/dsgwd ]; then
           mv /dstar/dsgwd/dsgwd /dstar/dsgwd/dsgwd2
        fi
    
        pkill -9 exec-gw-nonstop
        pkill -9 dsgwd
        /sbin/chkconfig --level 2 dstar_gw on
        /etc/init.d/dplus restart
        /etc/init.d/dstar_gw start
        echo "dsgwd starting"
        /opt/products/dstar/dstar_gw/dsgwd/gwstart.sh
        sleep 30
        echo "Linking REFxxx A REFxxx B"
        /root/lkref08
      fi
    fi
    FLAG=""
    done
    
  4. g2g1_grep.sh (2012 1/1)*2
    #!/bin/bash
    
    while :
    do
    FLAG=`/usr/sbin/tcpdump -vv dst host xx.xx.xxx.xxx -nXs 1000 -c 1`
    echo "$FLAG"; pkill -9 tcpdump
    DISCO=`echo "$FLAG" | grep -e "disconne"`
    TYPE=`echo "$FLAG" | grep -e "type" | cut -b62-67`
    if test $TYPE = "odulei" ; then
      URCALL=`echo "$FLAG" | grep -e "urcall" | cut -b60-69`
    fi
    if test $TYPE = "module" ; then
      URCALL=`echo "$FLAG" | grep -e "urcall" | cut -b61-68`
    fi
    echo "$TYPE urcall=$URCALL"
    if test "$DISCO" = ""; then
      if test "$URCALL" != "........" ; then
        date >> log01
        if test $TYPE = "odulei" ; then
          MYCALL=`echo "$FLAG" | grep -e "mycall" | cut -b62-67`
          URCALL=`echo "$FLAG" | grep -e "urcall" | cut -b60-69`
          RPT1=`echo "$FLAG" | grep -e "rpt1=" | cut -b58-65`
          RPT2=`echo "$FLAG" | grep -e "pt2=" | cut -b56-63`
        fi
        if test $TYPE = "module" ; then
          MYCALL=`echo "$FLAG" | grep -e "mycall" | cut -b63-68`
          URCALL=`echo "$FLAG" | grep -e "urcall" | cut -b61-68`
          RPT1=`echo "$FLAG" | grep -e "rpt1=" | cut -b59-66`
          RPT2=`echo "$FLAG" | grep -e "pt2=" | cut -b57-64`
        fi
    #    date; echo "$MYCALL"; echo "$URCALL"; echo "$RPT1"; echo "$RPT2"
        DT=`date`
        nTIME=`echo "$DT" | cut -b12-16`
        nDATA="$nTIME $MYCALL $URCALL $RPT1 $RPT2"
        oDT0=`tail -1 /root/trace.log`
        oDATA1=`echo "$oDT0" | cut -b11-15`
        oDATA2=`echo "$oDT0" | cut -d " " -f 7,8,9,10`
        echo "NewDATA=$nDATA"
        echo "OldDATA=$oDATA1 $oDATA2"
        if test "$nDATA" != "$oDATA1 $oDATA2"; then
          echo "New DATA!!"
          echo $DT $MYCALL $URCALL $RPT1 $RPT2 >>trace.log
        fi
    
        H_UR=`echo "$URCALL" | cut -b1`
        C_RPT1=`echo "$RPT1" | cut -b1-6`
        C_RPT2=`echo "$RPT2" | cut -b1-6`
        E_RPT2=`echo "$RPT2" | cut -b8`
        RPT1_G1=`grep $C_RPT1 /root/G1_rpt.txt`
        RPT2_G1=`grep $C_RPT2 /root/G1_rpt.txt`
        if (test "$H_UR" = "J" || test "$H_UR" = "7") && test "$RPT1_G1" != "" && test "$RPT2_G1" != "" && test "$E_RPT2" = "G"; then
          echo "going to G1"; echo "going to G1..." >>trace.log
    
    ###### go to G1 ######
          pkill -9 tcpdump
          chkconfig --level 2 dstar_gw off
          /etc/init.d/dstar_gw stop
          /etc/init.d/dplus stop
    
          if [ -f /dstar/dsgwd/dsgwd2 ]; then
             mv /dstar/dsgwd/dsgwd2 /dstar/dsgwd/dsgwd
          fi
    
          sleep 10
    
          /dstar/exec-gw
    
          sleep 600
    
    ###### go to G2 ######
          if [ -f /dstar/dsgwd/dsgwd ]; then
             mv /dstar/dsgwd/dsgwd /dstar/dsgwd/dsgwd2
          fi
    
          pkill -9 exec-gw-nonstop
          pkill -9 dsgwd
          /sbin/chkconfig --level 2 dstar_gw on
          /etc/init.d/dplus restart
          /etc/init.d/dstar_gw start
          echo "dsgwd starting"
          /opt/products/dstar/dstar_gw/dsgwd/gwstart.sh
          sleep 30
          echo "Linking REFxxx A REFxxx B"
          /root/lkref08
        fi
      fi
    fi
    
    FLAG=""
    done
    

URL B I U SIZE Black Maroon Green Olive Navy Purple Teal Gray Silver Red Lime Yellow Blue Fuchsia Aqua White


*1 JP1YJQ JP1YJXを除く
*2 trace.log に記録するtimingを1分以内同じframeは記録しないようにした

リロード   新規 下位ページ作成 凍結解除 差分 コピー 名前変更   ホーム 一覧 検索 最終更新 バックアップ リンク元   ヘルプ   最終更新のRSS
Last-modified: Sun, 01 Jan 2012 18:06:44 JST (4501d)