From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: From: "Valery V. Inozemtsev" Organization: ALT Linux Team To: ALT Linux sysadmin discuss Subject: Re: [Sysadmins] =?koi8-r?b?zc/OydTP0snOxw==?= =?koi8-r?b?IMvBzsHMwQ==?= Date: Mon, 13 Feb 2006 19:28:54 +0300 User-Agent: KMail/1.9.1 References: <20060213143736.GI9805@regiongarant.ru> <200602131900.08883.cityhawk@inbox.ru> <20060213161254.GA13731@ember.istranet.ru> In-Reply-To: <20060213161254.GA13731@ember.istranet.ru> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart1811282.JsSunJxf76"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit Message-Id: <200602131929.02026.shrek@freesource.info> X-BeenThere: sysadmins@lists.altlinux.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: ALT Linux sysadmin discuss List-Id: ALT Linux sysadmin discuss List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Feb 2006 16:29:22 -0000 Archived-At: List-Archive: --nextPart1811282.JsSunJxf76 Content-Type: multipart/mixed; boundary="Boundary-01=_HPL8DXXc6r3pXxq" Content-Transfer-Encoding: 7bit Content-Disposition: inline --Boundary-01=_HPL8DXXc6r3pXxq Content-Type: text/plain; charset="koi8-r" Content-Transfer-Encoding: base64 Content-Disposition: inline 9yDTz8/C3cXOyckgz9QgMTMgxsXX0sHM0SAyMDA2IDE5OjEyIE1heGltIEJvZHlhbnNreSDOwdDJ 08HMKGEpOgo+IE9uIPDOxCwg5sXXIDEzLCAyMDA2IGF0IDA3OjAwOjA4ICswMzAwIEV1Z2VuZSBB LiBTdWNoa292IHdyb3RlOgo+ID4g9yDTz8/C3cXOyckgz9QgMTMgxsXX0sHM0SAyMDA2IDE4OjI0 IE1heGltIEJvZHlhbnNreSDOwdDJ08HMKGEpOgo+ID4gPiA+IG5hZ2lvcz8KPiA+ID4KPiA+ID4g 787PINXNxcXUINPPwsnSwdTYINPUwdTJ09TJy9Ug0M8g1NLBxsnL1SDJINLJ08/XwdTYIMfSwcbJ y8k/Cj4gPgo+ID4g5c3VINzUzyDTz9fF0tvFzs7PIM7F2sHexc0uIOTM0SDc1M/HzyDF09TYIHNt bnAgySBtcnRnLgo+Cj4g9M/WxSDN2dPM2CA6KQo+IPrOwcvPzdnKINXQz83RzsHMIGNyaWNrZXQg KGh0dHA6Ly9jcmlja2V0LnNvdXJjZWZvcmdlLm5ldCkgy8HLCj4g0MXSxdLBws/Uwc7VwCDBzNjU xdLOwdTJ19UgbXJ0Zy4g69TPLc7JwtXE2CDNz9bF1CDe1M8g08vB2sHU2CDPwiDc1M/NPwo+Cj4g PiDoz9TRLCDQz83OydTT0SDNzsUsIN7Uzy3UzyBuYWdpb3Mg1c3FzCDSydPP18HU2Ao+Cj4g7sEg 08HK1MUgxdPU2CDTy9LJztvP1CBjIMfJ09TPx9LBzc/KINPPwtnUycoKPiAoaHR0cDovL25hZ2lv cy5zb3VyY2Vmb3JnZS5uZXQvaW1hZ2VzL3NjcmVlbnMvYmlnL2hpc3RvZ3JhbS5qcGcpCj4g7sHX xdLOz8UsINzUzyDJINfToy4KCsvByyDVINfB0yDX08Ug08zP1s7PLiDEzNEgzc/OydTP0snOx8Eg 0SDLwcsg1M8gzsHQydPBzCDTy9LJ0NQgKNcgwdTB3sUpIMTM0SAK0NLP18XSy8kg1snXL87F1snX LCDawdDV08vBxdTT0SDQzyDL0s/O1S4gzc/Wzs8gxM/QydPB1Ngg1MHNIMXdxSDBzsHMydogCtfS xc3Fzskgz9TLzMnLwSDEzNEgy8/O1NLPzNEg08vP0s/T1MkKCi0tIApWYWxlcnkgVi4gSW5vemVt dHNldgo= --Boundary-01=_HPL8DXXc6r3pXxq Content-Type: application/x-shellscript; name="tunnel_check" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="tunnel_check" #!/bin/sh =2E /etc/init.d/functions STATFILE=3D"/var/run/network.stat" if [ ! -f "$STATFILE" ]; then echo "KRSTAT=3D1" > "$STATFILE" echo "NBNSTAT=3D1" >> "$STATFILE" echo "OUTSTAT=3D1" >> "$STATFILE" fi SourceIfNotEmpty "$STATFILE" IP_KR=3D"10.24.0.253 10.24.0.254" IP_NBN=3D"212.XXX.XXX.XXX 10.25.0.XXX" IP_OUT=3D"202.XXX.XXX.XXX 62.XXX.XXX.XXX" MAILTO=3D",," SENDTEXT=3D0 STATTEXT=3D"" ping_c() { ping -c 5 $1 | grep -q 'ttl.*time' >/dev/null 2>&1 } #--------------------------------------------- STAT=3D0 for i in $IP_KR; do if ping_c $i; then STAT=3D$(($STAT+1)) STATTEXT=3D"$STATTEXT =EB=D2=C1=D3=CB=CF=D7=CF [$i] - =D3=D4=C1=D4=D5=D3 =EF=EB" else STATTEXT=3D"$STATTEXT =EB=D2=C1=D3=CB=CF=D7=CF [$i] - =D3=D4=C1=D4=D5=D3 =EE=E5 =EF=EB" fi done if (( $STAT >=3D 1 )); then echo "KRSTAT=3D1" > "$STATFILE.new" if (( $KRSTAT !=3D 1 )); then SENDTEXT=3D1 fi else echo "KRSTAT=3D0" > "$STATFILE.new" if (( $KRSTAT !=3D 0)); then SENDTEXT=3D1 fi fi #----------------------------------------------- STAT=3D0 for i in $IP_NBN; do if ping_c $i; then STAT=3D$(($STAT+1)) STATTEXT=3D"$STATTEXT NetByNet [$i] - =D3=D4=C1=D4=D5=D3 =EF=EB" else STATTEXT=3D"$STATTEXT NetByNet [$i] - =D3=D4=C1=D4=D5=D3 =EE=E5 =EF=EB" fi done if (( $STAT >=3D 1 )); then echo "NBNSTAT=3D1" >> "$STATFILE.new" if (( $NBNSTAT !=3D 1 )); then SENDTEXT=3D1 fi else echo "NBNSTAT=3D0" >> "$STATFILE.new" if (( $NBNSTAT !=3D 0)); then SENDTEXT=3D1 fi fi #----------------------------------------------- STAT=3D0 for i in $IP_OUT; do if ping_c $i; then STAT=3D$(($STAT+1)) STATTEXT=3D"$STATTEXT Internet [$i] - =D3=D4=C1=D4=D5=D3 =EF=EB" else STATTEXT=3D"$STATTEXT Internet [$i] - =D3=D4=C1=D4=D5=D3 =EE=E5 =EF=EB" fi done if (( $STAT >=3D 1 )); then echo "OUTSTAT=3D1" >> "$STATFILE.new" if (( $OUTSTAT !=3D 1 )); then SENDTEXT=3D1 fi else echo "OUTSTAT=3D0" >> "$STATFILE.new" if (( $OUTSTAT !=3D 0)); then SENDTEXT=3D1 fi fi mv "$STATFILE.new" "$STATFILE" if (( $SENDTEXT =3D=3D 1 )); then ( echo "To: $MAILTO" echo "From: status@mail.inet.net" echo "Content-Type: text/plain; charset=3DKOI8-R; format=3Dflowed" echo "Content-Transfer-Encoding: 8bit" echo "Subject: Network status" echo "$STATTEXT" ) 2>&1 | /usr/sbin/sendmail -t fi --Boundary-01=_HPL8DXXc6r3pXxq-- --nextPart1811282.JsSunJxf76 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (GNU/Linux) iD8DBQBD8LPNsICip9pMw6cRArzzAJsGQDCkz5UxMMSiLdXyhR8wgCMlKwCdFGwZ YLwWWkETFnyCIaTKbRtp6CA= =4i5b -----END PGP SIGNATURE----- --nextPart1811282.JsSunJxf76--