OpenNetwork.xyz   Placeholder for our stuff related to Telecom, IT, Internet of things (IOT), ESP8266, Raspberry Pi

Ping Drop Capture Script for Solaris

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
LogFileOK="/tmp/pingLog-"$host"-OK.txt"
LogFileDown="/tmp/pingLog-"$host"-DOWN.txt"

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.




USAGES

./myPingScript.sh 10.40.2.34  
 OR
./myPingScript.sh google.com










Running script in background

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 &


 

© 2019 Suresh Hariramani