wombat.ch

your Partner for Network Design and CMS

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 
 
     

RSS Feed

part of ...

Linux Counter

Disqus

 

Learning Network

Seti@home & Boinc

myBonic

statistik

 


Who is Online

We have 123 guests and no members online

We have 115 guests, no bots and no members online