Subject: Re: piping "ping" output in a background job
To: James K. Lowden <jklowden@schemamania.org>
From: Manuel Bouyer <bouyer@antioche.eu.org>
List: netbsd-help
Date: 10/05/2003 14:31:06
On Sat, Oct 04, 2003 at 04:50:47PM -0400, James K. Lowden wrote:
> $ ping -i 120 -o di |xmessage -file - &
> [4] 1305
> $ jobs -ls; ps -aux |egrep '^USER|130[45]'
> [4]+ 1304 Stopped (tty output) ping -i 120 -o di
> 1305 | xmessage -file -
> USER PID %CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND
> jklowden 1305 0.0 0.0 24 28 p0 T 4:04PM 0:00.01 xmessage
> -file
> root 1304 0.0 0.2 352 248 p0 T 4:04PM 0:00.01 ping -i
> 120 -o
>
> The machine "di" is down; I started the above poll to tell me when it
> comes back up. But why is the job stopped? I don't understand.
>
> "stopped" AIUI means ping, above, can't write to the tty. I'm guessing it
> has something to do with the fact that ping is set-uid root, and job
> control doesn't have any way to write its output to my tty. Except I'd
> expect ping's output to go to its stdout, which obviously is piped to
> xmessage. And except that traceroute(8) is also set-uid and works fine.
> So I think it's something special about ping.
If di is down, ping may need to be able to print some error message to
stderr. You need to redirect stderr as well
--
Manuel Bouyer <bouyer@antioche.eu.org>
NetBSD: 24 ans d'experience feront toujours la difference
--