Results 1 to 4 of 4
Hi there,
I'm looking to open two xterm windows and have them both tail -f a couple of log files. so my question is: How do you do this? Also, ...
- 10-08-2007 #1Just Joined!
- Join Date
- Oct 2007
- Posts
- 2
Opening two xterm windows through a script
Hi there,
I'm looking to open two xterm windows and have them both tail -f a couple of log files. so my question is: How do you do this? Also, is there a way I can make the two new xterm windows independent from the original xterm window that I launch the script in, in other words, I'd like to be able to close the original xterm window without the two new windows closing.
Can this be done?
Thanks in advance.
- 10-08-2007 #2Linux Engineer
- Join Date
- Nov 2004
- Location
- Ft. Polk, LA
- Posts
- 796
You can specify what program to run when you start xterm with the -e option. See the xterm man page for more info. As far as closing xterm but keeping the other things open, I forget how to do that. For some reason I think it's actually a shell option, but don't quote me on that. I didn't see anything about it by skimming through xterm or bash man page, but I could have missed it.
- 10-08-2007 #3Just Joined!
- Join Date
- Oct 2007
- Posts
- 2
okay, thanks, I have found the command that I need and it works perfectly when executing it directly from the command prompt, but it doesn't work when run from a simple script file..
The comamnd I'm using is..
xterm -e tail -f data/dev.log &
the second log is opened with:
xterm -e tail -f data/op.log &
BTW, the & is what makes the new window independant of the original window...
So, that works from the command prompt, but putting the two commands in a file like this:
xterm -e tail -f data/dev.log &
xterm -e tail -f data/op.log &
then just CHMOD'ing the file 775 and running it opens and closes the windows. i'm left with nothing except the first xterm window where I executed the script from.
What's happening here? How can i keep both of the windows open and alive?
Thanks!
- 10-09-2007 #4
Start the script with the & option instead of the embedded commands. ie run the script as a new process (thread) not new processes for each command.


Reply With Quote