Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm trying to make a script that save the ping logs to .txt or .log file. To monitor if my connection is intermittent or not, I'm using this script:

$nohup ping 8.8.8.8 > timeout.txt &

Then when I check if its pinging:

$tailf timeout.txt

It's working! But when I stop the process by using:

$kill (process)

timeout.txt file is stop pinging but didn't show the statistic logs if I had any timeout or packet loss.

How to stop the ping and also showing the statistic?
Or do I have to add a script to my script?

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted
kill -SIGQUIT `pgrep ping`

to show statistics and do not stop ping.

kill -SIGINT `pgrep ping`

to show statistics as usual (e.g., when you press ctrl-c in terminal) and stop ping.

share|improve this answer
    
Thanks for the Help 'int' :) –  oacebes Apr 8 '13 at 8:01
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.