Birbal Birbal - 1 year ago 117
Bash Question

How to redirect the output of csh script that runs in background

I'm running multiple csh scripts in parallel (each script takes 2 arguments) that does a lots of funny stuff in the background (details are not important to my problem). So far I'm running them as:

my_script arg1 arg2 &
my_script arg3 arg4 &

This works just fine but I would like that each run of the script to redirect it's standard output into a log file. If I do the following command works well:

my_script arg1 arg2 >! somefile.log

The problem is that I need to run at least 5 of these scripts in parallel (background each of them). When I try the following sequence, the jobs are dispatched but is reported as "Suspended (tty output)" and the log file is not updating:

my_script arg1 arg2 >! somefile.log &
my_script arg3 arg4 >! somefile1.log &
my_script arg5 arg6 >! somefile2.log &

Any ideas to this issue. Oh...also I forgot to mention that I need to use CSH unfortunatelly I can't switch to bash or anything else.

Many thanks!

Answer Source

Please try

nohup my_script arg1 arg2 < /dev/null >! somefile.log &

You can also try

stty -tostop

to manage the terminal mode

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download