In last article we saw how to capture ping drops in linux. For solaris we need to modify our script a little bit.
Define the name and location of log files in script as in following lines
Ensure that user running the script has write permissions on filepath given.
If you don't wish to log ping ok times then do not use
following redirection line in scropt
echo -e "`date +'%Y/%m/%d %H:%M:%S'` - host $host is \033[0;32mok\033[0m -`echo $result | cut -d ':' -f 2`"
Define sleep time as per your requirement, save and make file executable using chmod command.
Running script with nohup will keep it running in background. nohup command line-utility allows to run command/process or shell script that can continue running in the background after you log out from a shell.
nohup ./myPingScript.sh 10.40.2.38 | grep down >> myLogFile.txt &
I am an IOT enthusiast with more than 20 years of experience in the IT sector. Specializing in telecom service's; follow me for some very innovative and best in class IOT products as I unfold my knowledge and passion for the subject.
Just me, myself and I, exploring the universe of uknownment. I have a heart of love and interests in technology, IOT and travel . And I want to share my world with you .