Running script in background

When I run the following snippet in background

#!/bin/ksh
while [ ${i:=1} -le 10 ]
do
        echo "$i"
        sleep 10
        i=`expr $i + 1`
done

My job got stopped and it says like [1] + Stopped (SIGTTOU) ex1 &

I did "stty tostop" as suggested in many of the post but still not working properly.

Can somebody help me in this issue?

Thanks,
Shahnaz.

If you run your snipet like snipet&,
it will run in background... if you call it back with fg , then Ctrl-z will suspend (and you will have displayed:
[1] + Stopped snipp& )
you will have to type bg to send it back working in background...

Thanks for reply.

I know how to suspend & run it again in FG/BG...

My problem here is, it is running only in foreground not in background. Hopefully you understood my issue! If I run in BG then it should wrie into log file instead it is suspending...

Thanks,
Shahnaz.

any update experts?