So you're having a problem with the redirection of the & output instead
of the while loop output.
How about this from the LDP about reassigning STDOUT.
#!/bin/bash
exec 6>&1 # Link file descriptor #6 with stdout.
# Saves stdout.
while true; do
dd if=/scratch/dummy of=/scratch/junk bs=64k >/dev/null 2>&1
rm /scratch/junk
sync
done >/dev/null 2>&1 &
exec 0<&6 6<&-
# Now restore stdin from fd #6, where it had been saved,
#+ and close fd #6 ( 6<&- ) to free it for other processes to use.
#
# <&6 6<&- also works.
I wasn't able to reproduce the result mind you.
I would run this script above (without the execs), it would exit
immediately, and then I would go and kill it and I recieved no kill
messages.
Perhaps a better test case would set me straight, this does however
generate a lot of disk I/O.
REF:
http://www.tldp.org/LDP/abs/html/x11693.html#REASSIGNSTDOUT
-Mike
Greg Freemyer wrote:
> Nathan,
>
> I have the very basics of a new test almost working. I'm assuming it will be
> 068.
>
> One big problem I have is that I start a background infinite loop of dd's to
> generate some i/o load.
>
> i.e.
> while true; do
> dd if=/scratch/dummy of=/scratch/junk bs=64k >/dev/null 2>&1
> rm /scratch/junk
> sync
> done >/dev/null 2>&1 &
|