wombat.ch

your Partner for Network Design and CMS

Space

Ein paar scripte gefunden im Netz.


  #!/bin/bash

plainip="$(host $1 | grep address|grep -v IPv6| awk 'NR == 1{print $4}')"
#echo $plainip

ip=$plainip

reverse_ip=$(echo $ip | awk -F "." '{print $4"."$3"."$2"."$1}')

asn_info=$(dig +short $reverse_ip.origin.asn.cymru.com TXT)
peer_info=$(dig +short $reverse_ip.peer.asn.cymru.com TXT)

number=$(echo $asn_info | cut -d'|' -f 1 | cut -d'"' -f 2 | cut -d' ' -f 1)
asn="as$number"

asn_report=$(dig +short $asn.asn.cymru.com TXT)

subnet=$(echo $asn_info | cut -d'|' -f 2)
country=$(echo $asn_info | cut -d'|' -f 3)
issuer=$(echo $asn_info | cut -d'|' -f 4)

peers=$(echo $peer_info | cut -d'|' -f 1 | cut -d'"' -f 2)

registry_date=$(echo $asn_report | cut -d'|' -f 4)
registrant=$(echo $asn_report | cut -d'|' -f 5 | cut -d'"' -f 1)

echo -e " Query:\t $ip"
echo -e " Subnet:\t $subnet"
echo -e " Registrant:\t $registrant"
echo -e " AS Number:\t $asn"
echo -e " Country:\t $country"
echo -e " Issuer:\t $issuer"
echo -e "Registry Date:\t $registry_date"
echo -e " Peer ASNs:\t $peers"
$ /sbin/host2ip2asn heise.de  Link 
       
       
Add a comment
If Ping fail do a action



  #!/bin/bash
IP='192.168.1.1'
fping
-c1 -t300 $IP 2>/dev/null 1>/dev/null
if [ "$?" = 0 ]
then
    echo
"Host found"
else
    echo
"Host not found"
fi
 
     
 

ping -c4 10.18.23.1 > /dev/null

if [ $? != 0 ]
then
echo "No network connection, restarting wlan0"
/sbin/ifdown 'wlan0'
 sleep 5
 /sbin/ifup --force 'wlan0'
 fi

 
     
will check the feedback 0 or 1 ping 10.147.42.63 ; echo $?  
     
  #   vi /usr/local/bin/vm162restart.sh  
  #!/bin/bash
IP='192.168.1.1'

ping -c4 $IP > /dev/null

if [ $? != 1 ]


then
    echo "Host found"
else

echo "host not found - restart...."
   qm reset xxx
   qm resume xxx
   qm start xxx
fi 
 
  #   chmod +x /usr/local/bin/vm162restart.sh  
     
     
  #!/bin/bash

status_code
=$(curl --write-out %{http_code} --silent --output /dev/null www.bbc.co.uk/news)

if
[[ "$status_code" -ne 200 ]] ; then 
      echo
"Site status changed to $status_code" | mail -s "SITE STATUS CHECKER" "This email address is being protected from spambots. You need JavaScript enabled to view it." -r "STATUS_CHECKER"

else

      exit
0

fi
 
 
  url='http://localhost:8080/'
status
=$(curl --head --location --connect-timeout 5 --write-out %{http_code} --silent --output /dev/null ${url})
[[ $status == 500 ]] || [[ $status == 000 ]] && echo restarting ${url} # do start/restart logic 
 
     
Add a comment

RSS Feed


Warning: Invalid argument supplied for foreach() in /var/www/clients/client2/web2/web/j/modules/mod_jw_srfr/helper.php on line 39

Warning: Invalid argument supplied for foreach() in /var/www/clients/client2/web2/web/j/modules/mod_jw_srfr/helper.php on line 39

neusten Links


Warning: count(): Parameter must be an array or an object that implements Countable in /var/www/clients/client2/web2/web/j/modules/mod_quicklistweblinks/helper.php on line 78
many More Links »

part of ...

Linux Counter

Disqus

 

Learning Network

Seti@home & Boinc

myBonic

statistik

 


Who is Online

We have 422 guests and no members online

We have 453 guests, no bots and no members online