I have a script file pingIP.sh which just pings the given IP address,
ping -c 70 74.125.228.71
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 74.125.228.71 (74.125.228.71) 56(84) bytes of data.
64 bytes from 74.125.228.71: icmp_seq=1 ttl=122 time=256 ms
64 bytes from 74.125.228.71: icmp_seq=2 ttl=122 time=244 ms
64 bytes from 74.125.228.71: icmp_seq=3 ttl=122 time=250 ms
64 bytes from 74.125.228.71: icmp_seq=4 ttl=122 time=254 ms
64 bytes from 74.125.228.71: icmp_seq=5 ttl=122 time=243 ms
Executing the 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?
Process.destroy()
if you are doing this from Java. – Joni Jun 11 '13 at 09:59kill -9
– Lesmana Jun 11 '13 at 12:10