Re: open multiple xterms with script
Thank you George and Polytropon that seems to do the trick... ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: open multiple xterms with script
On Wed, 3 Dec 2008 09:58:52 +0200, Aggelidis Nikos [EMAIL PROTECTED] wrote: Thank you for your help! some additional questions: 1) is there any way to give the root password once? i tried this: #!/bin/sh su root -c \ xterm -geometry 80x25 -title 'App 1' -e 'app1' xterm -geometry 80x25 -title 'App 2' -e 'app2'\ but i get this: xterm Xt error: Can't open display: %s su doesn't preserve the DISPLAY environment variable, so you can use one of the following: sudo bash -c xterm xterm su root -c DISPLAY=$DISPLAY ; export DISPLAY ; xterm xterm i don't think i need something so complex. Is there any way to instruct xterm not to close after the execution of the program? I'm not sure. It may be possible to play shell-specific tricks that cause `app1' to be executed as part of the shell's startup scripts. ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: open multiple xterms with script
On Wed, 3 Dec 2008 09:58:52 +0200, Aggelidis Nikos [EMAIL PROTECTED] wrote: some additional questions: 1) is there any way to give the root password once? i tried this: #!/bin/sh su root -c \ xterm -geometry 80x25 -title 'App 1' -e 'app1' xterm -geometry 80x25 -title 'App 2' -e 'app2'\ but i get this: xterm Xt error: Can't open display: %s Exactly. When you su root, $DISPLAY is not set, so you would have to set it first, maybe like this: #!/bin/sh su root -c \ export DISPLAY=:0.0; \ xterm -geometry 80x25 -title 'App 1' -e 'app1' xterm -geometry 80x25 -title 'App 2' -e 'app2' \ 2) Is there any way to instruct xterm not to close after the execution of the program? You could do this: xterm -geometry 80x25 -title 'App 1' -e 'app1 ; csh' which would start your prefered dialog shell when app1 has finished. The dialog shell would run even if app fails (thatÄs why I suggest using ; instead of ). So basically the idea is open 4 terminals, execute a specific command inside them but if the command finishes or stops, the terminal stays {with a new prompt}. This sould be able to be achieved using the example above. -- Polytropon From Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ... ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: open multiple xterms with script
On Tue, 2 Dec 2008 10:07:47 +0200, Aggelidis Nikos [EMAIL PROTECTED] wrote: hi to all the list, i need some help... Is it possible to open four consoles as root(authenticate yourself once), in each one run a specific program and do this through a script? {bash or python). i want to open 4 xterms in the four corners of the screen. In 3 xterms i want to run specific applications needing root privileges and the last i want it for administrative purposes. what i have so far: sudo xterm -e path/to/application1 sudo xterm -e path/to/application2 sudo xterm -e path/to/application3 sudo xterm But this approach has the following problems: 1) i have only managed to get it to work as sudo not su 2) i haven't managed to position the 4 terminals correctly in the 4 corners of the screen Maybe this is a solution for you (or at least a point to start): #!/bin/sh xterm -geometry blahblah -title App 1 -e su root -c app1 xterm -geometry blahblah -title App 2 -e su root -c app2 xterm -geometry blahblah -title App 3 -e su root -c app3 xterm -geometry blahblah -title App 4 -e su root -c app4 The -geometry is set as ROWSxCOLS+X+Y, e. g. 80x25+0+0 for the upper left corner. See man xterm for further options as you could need them. 3) i want to be able to close and restart a single terminal.without running again the whole script (this i am not sure if it is even doable). For example if one of the applications hungs, then i want to be able to restart this application, without running the whole script again. You could create a wrapper script that calls four scripts which only start one of the four applications each. ~/bin/run_1: #!/bin/sh xterm -geometry blahblah -title App 1 -e su root -c app1 ~/bin/run_2: #!/bin/sh xterm -geometry blahblah -title App 2 -e su root -c app2 ~/bin/run_3: #!/bin/sh xterm -geometry blahblah -title App 3 -e su root -c app3 ~/bin/run_4: #!/bin/sh xterm -geometry blahblah -title App 4 -e su root -c app4 ~/bin/run_all: #!/bin/sh ~/bin/run_1 ~/bin/run_2 ~/bin/run_3 ~/bin/run_4 Not very elegant and tidy, but should work. You could add some checking to the first script mentioned so it gets a clue which application is *not* running and restart it when called, not starting those that are running again (second session). -- Polytropon From Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ... ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: open multiple xterms with script
Thank you for your help! some additional questions: 1) is there any way to give the root password once? i tried this: #!/bin/sh su root -c \ xterm -geometry 80x25 -title 'App 1' -e 'app1' xterm -geometry 80x25 -title 'App 2' -e 'app2'\ but i get this: xterm Xt error: Can't open display: %s 2) Not very elegant and tidy, but should work. You could add some checking to the first script mentioned so it gets a clue which application is *not* running and restart it when called, not starting those that are running again (second session). i don't think i need something so complex. Is there any way to instruct xterm not to close after the execution of the program? So basically the idea is open 4 terminals, execute a specific command inside them but if the command finishes or stops, the terminal stays {with a new prompt}. ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]