TIME NOW
World current time now,
CALENDAR
Calendar monthly, yearly
login CONVERT LENGTH
login CONVERT TEMPERATURE
login DICTIONARIES, LISTS
login SCIENCE EDUCATION RELIGION
login WORK CALCULATOR
login CALCULATE LIFE

Linux commands, scripts, examples, tutorial

Previous articlePage bottomNext article  ALL TOPICS

Linux. Check, connection server - internet

 Run on cron:
/etc/crontab

*/3 * * * * root /_scripts/_cron_init/ping.script
Few pings file ping.script.
date=`date "+%m_%d"`
log="/_scripts/_cron_init/_ping/ping$date.log"
/bin/date >> $log
/bin/ping -c 3 -q www.typo3.as >> $log 2> /dev/null
/bin/ping -c 3 -q www.example.lt >> $log 2> /dev/null
/bin/ping -c 3 -q www.yahoo.com >> $log 2>/dev/null
# 7.2 min per diena 0.5% laiko

Sometines you should use tee command
/bin/ping -c 3 -q www.typo3.as | tee>> $log 2> /dev/null
Permissions:
chmod 700 /_scripts/_cron_init/ping.script
Another analytics script, which uses prevoiously generated logs:
sleep 2
folder="/_scripts/_cron_init/ping/"

# 1 dalis- filtruoti

# grep -H "[a-zA-Z]" ${folder}ping*.log | grep -v "rtt " | grep -E -B 8 -A 8 "(66%){1}|(100%){1}" > ${folder}ping_analyze.log
grep -H "[a-zA-Z]" ${folder}ping*.log | grep -v "rtt " | grep -E -B 8 -A 8 "(100%){1}" > ${folder}ping_analyze.log

# 2 dalis- problemas išvesti į ekraną
sleep 2
echo
echo Ping Statistics
# grep -H "[a-zA-Z]" ${folder}ping*.log | grep -v "rtt " | grep -E "(66%){1}|(100%){1}" | wc -l
grep -H "[a-zA-Z]" ${folder}ping*.log | grep -v "rtt " | grep -E "(100%){1}" | wc -l

"No connect" periods are received. 
Previous articlePage topNext article  ALL TOPICS


Guest:
I use cron and check internet availability on server. It is launches every 5 minutes. Once i have uncovered not honest provider.
log="/_scripts/_cron_init/_ping.log"
/bin/date >> $log
/bin/ping -c 3 -q wwwaddress1.lt >> $log 2> /dev/null
/bin/ping -c 3 -q wwwaddress2.com   >> $log 2>  /dev/null
/bin/ping -c 3 -q wwwaddress3.com   >> $log 2>/dev/null
# 7.2 min per diena 0.5% laiko


2013-06-07 11:13:21

 Use username: Guest, Anonymous, Programmer






QUOTES:
Love is a gross exaggeration of the difference between one person and everyone else.
William Shakespeare, Venus & Adonis
Romance, like the rabbit at the dog track, is the elusive, fake, and never attained reward which, for the benefit and amusement of our masters, keeps us running and thinking in safe circles.
Beverly Jones
Forgive, son; men are men; they needs must err.
Euripides