I have a script file pingIP.sh which just pings the given IP address,
ping -c 70 220.127.116.11
The problem is when I try to stop the executed script in the middle its not stopping it properly.
Using linux cmd
ps -ef|grep pingIP |grep -v 'grep pingIP' I'm able to get the process id, and killing it using cmd
kill -9 processid.
For example, executing script file
PING 18.104.22.168 (22.214.171.124) 56(84) bytes of data. 64 bytes from 126.96.36.199: icmp_seq=1 ttl=122 time=256 ms 64 bytes from 188.8.131.52: icmp_seq=2 ttl=122 time=244 ms 64 bytes from 184.108.40.206: icmp_seq=3 ttl=122 time=250 ms 64 bytes from 220.127.116.11: icmp_seq=4 ttl=122 time=254 ms 64 bytes from 18.104.22.168: icmp_seq=5 ttl=122 time=243 ms
kill command now just stops the script execution but ping response is continuing until specified ping count is reached.
Any suggestions to avoid the ping execution even after stopping the execution of script file?