trying to run a script in the background redirect the output to a file
I wrote a short script that sleeps for 30 seconds then outputs "Done" to the screen:
sleep 30 echo Done now I want to re-direct the output to a file, I tried: ./scriptName& > fileName Didn't work, "Done" still came out to the screen. |
Try
Code:
sleep 30 |
tried it but couldn't do any thing else until it finished, I just want it running in the background so I can do other work.
P.S. I am very new to LINUX |
Quote:
Code:
# ./scriptName > fileName 2>&1 & |
Code:
./scriptName > fileName 2>&1 & |
Quote:
|
When i run a python script in the background and redirect the result to a file the output is coming only few minutes
The redirection the result of a background python script to the file,the redirection of output is not happening after few lines.
I'm running a python script in linux ubuntu os: python3 /pathtoscript/script.py > file.txt 2>&1 & |
Quote:
That said, your redirection looks right. What do you mean by "not happening?" What happens if you run the script in the foreground with no redirection? Do you get more lines than you do in the file? |
All times are GMT -5. The time now is 04:39 PM. |