Search This Blog

Tuesday, January 28, 2014

Shell script to ping IP


#!/bin/bash

ping -c 4 $1 > /dev/null
if [[ $? -eq 0 ]]
then
echo "ping success at $(date)" >> /tmp/check_vpn.log
else
echo "ping failed at $(date)" >> /tmp/check_vpn.error
fi


To use it:

# ./check_vpn.sh 192.168.1.1

Or:

crontab:

* * * * * check_vpn.sh 192.168.1.1

1 comment:

  1. I just figured out that my computer has this kind of trojan. I was running pretty much all of the Anti-virus things my computer has. The main one says there is nothing there and my Windows defender says I have two trojans so I'm not sure what to do. I'm thinking of buying or building a new one. . Right now I have intel. Im not sure which is best like Dell, Miscrosoft, etc. I need a gaming computer which can also be used as a school work computer. Any ideas?.

    ReplyDelete