-   Linux - General (
-   -   Switch stdout between /dev/null and a file? (

gremlin2000 06-01-2004 10:20 AM

Switch stdout between /dev/null and a file?
(Originally posted to the newbie forum, but it was suggested that that was not the correct place)

I have a script which I run using nohup. When I run it it will (as expected) redirect the output to the file nohup. This is great because I can tail -f the file and see whats going on. I want to stop this file from filling my disk while I'm not logged in (but leave the script running) but still be able to tail -f it to see the output when I am logged in. Is there a way to switch the output from nohup between this file and /dev/null while it is running?
(or maybe use cron to truncate the file every now and then?).


brassfish 06-01-2004 02:39 PM

Setup a crontab entry that does a 'tail filename>filename' every few minutes.

gremlin2000 06-08-2004 07:12 AM

That's not a bad idea. It did the job until I discovered the screen command. That does the job without having to direct the output to a file and I can easily have several of them running.

All times are GMT -5. The time now is 06:49 PM.