I have to run a script background and also i have to catch the STDERR and STDOUT . i'm using the below line .
test.sh & >> log_file 2>&1
But un fortunately nothing is getting written to log_file
Please help me here
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.
Sign up to join this communityNote the position of the background &
character:
test.sh >> log_file 2>&1 &
This works
( echo stdout; echo >&2 stderr )& >> log 2>&1;
sleep 0.1; echo LOG:; cat log
and shows that both stdout and stderr get to the log.
The error must be somewhere in your test.sh
.