Placeholder for our stuff related to Telecom, IT, Internet of things (IOT), ESP8266, Raspberry Pi
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 &