View Full Version : How to stop ping in bash?
cokekid
03-16-2006, 09:00 PM
Super Newbie question!
if I ping something in bash ie. ping 192.168.1.1
How do I stop it from pinging?? It will go on forever otherwise.. can I add anything to the ping command to make it stop?
I tried CTRL-C and anything I can think of...
fantmn
03-16-2006, 09:08 PM
I checked the ping man page here (http://www.die.net/doc/linux/man/man8/ping.8.html) (used google to find it) the -c option of ping specifies a count. So ping -c 5 10.1.1.1 would do 5 pings to 10.1.1.1 and then stop. Tested it on my Tivo and -c works.
The only way I found to stop it was to telnet in do a ps -ef to find it and then use kill -s 9 processid to kill the process running the ping.
ocntscha
03-16-2006, 09:25 PM
Where did you guys find a ping that won't respond to Ctrl C? I've got the ping in Alphawolf's busybox collection and it responds to Ctrl C just fine.
fantmn
03-16-2006, 10:50 PM
It has been my experience that when connected through the serial port the ctl-c does not work. Not sure where cokekid was running his from.
ocntscha
03-17-2006, 01:25 AM
It has been my experience that when connected through the serial port the ctl-c does not work. Not sure where cokekid was running his from.Also included in Alphawolf's tivotools.tar.rar is setsid. You can start your serial port bash with setsid and then you won't have that problem. Something like the following works very well..
/hack/setsid /bin/bash --login < /dev/ttyS2 &> /dev/ttyS2 &
/bin/stty rows 24 columns 80 < /dev/ttyS2
If TERM is set to xterm you shouldn't have any problems on the serial port. Control characters will work and so will commands that make full use of the terminal window like vi, top, less, what have you.
cokekid
03-17-2006, 02:02 AM
Thanks guys. Lots of help. I was worried I was gonna get flammed for that post.
And "Yes" I was using ping command in Bash via serial cable. Never tried it via telnet cause I didnt want to reboot the system :)
vBulletin® v3.7.3, Copyright ©2000-2008, Jelsoft Enterprises Ltd.