Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Improve terminal/script startup time UNIX
Ever notice how Terminal just sorta sits there when you start? Or if you have a script, sometimes it just seems to do nothing for a bit before actually doing its stuff. The reason it happens is that 1) you're using Fink 2) you're probably also following a previous hint that told you to set DISPLAY to :0.0 so that you can launch X stuff from your Terminal.app.

What happens is that your fink startup scripts try to run xfontpath ... only your X server probably isn't even running yet. So it sits there and hangs, waiting to contact the X server and eventually gives up, which is where your script, or the Terminal, kicks in.

How do you fix this? By delaying the setting of the DISPLAY variable until after executing the fink init. In your .cshrc file, add:
# in case you're running a script
unsetenv DISPLAY
source /sw/bin/init.cshrc
setenv DISPLAY :0.0
And naturally, if you're using bash, you know what to do.
    •    
  • Currently 0.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (0 votes cast)
 
[6,289 views]  

Improve terminal/script startup time | 6 comments | Create New Account
Click here to return to the 'Improve terminal/script startup time' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Typo?
Authored by: gvitale on May 17, '02 10:21:48AM

Shouldn't it be:

# in case you're running a script
unsetenv DISPLAY
source /sw/bin/init.csh
setenv DISPLAY :0.0

???



[ Reply to This | # ]
Re: Improve terminal/script startup time
Authored by: Impatient1 on May 17, '02 10:53:36AM
Technically, it's not the smartest thing to set the DISPLAY variable from within .cshrc (or any other shell startup file) if you use more than one machine. Murphy will make sure whichever machine you are using will not match the display setting. I always created aliases for different machines instead (in .cshrc) as below:


alias macdisplay 'setenv DISPLAY 192.168.123.001:0.0'
alias sundisplay 'setenv DISPLAY 192.168.123.002:0.0'
alias ntdisplay 'setenv DISPLAY 192.168.123.003:0.0'


then set it according to the machine I was sitting in front of.
For example, to display SUN xterm on Macintosh do:


$ ssh impatient1@blade # imaginary SUN workstation account
$ macdisplay # tell X server to display X clients on my iMac
$ xterm &




[ Reply to This | # ]
Speeding Up Terminal Startup
Authored by: michaelfr on May 17, '02 09:41:22PM

Aside from the typo on the original hint, this one worked beatifully for me!



[ Reply to This | # ]
$DISPLAY & vim
Authored by: klez23 on May 20, '02 03:45:20AM

i find it useful to have the following alias:
alias vi='vim -X'
this tells vim to ignore the DISPLAY variable, & start up quickly, for the same reason mentioned in the hint.

peter



[ Reply to This | # ]
FROM the fink-users@lists.sourceforge.net
Authored by: gvitale on May 21, '02 05:56:46AM

Martin Costabel wrote:

I am using the following in my ~/Library/init/tcsh/path file (I think it
must be in the list archive somewhere already)

if ( $?DISPLAY ) then
set OLDDISPLAY=$DISPLAY
unsetenv DISPLAY
source /sw/bin/init.csh
setenv DISPLAY $OLDDISPLAY
else
source /sw/bin/init.csh
endif

--
Martin



[ Reply to This | # ]
Re: Improve terminal/script startup time
Authored by: kholburn on Jun 15, '02 03:17:14AM

I use this in my .tcshrc file:

if ( `ps -awwwux|grep XDarwin |grep -vc grep` > 0 ) then
setenv DISPLAY :0.0
endif

Doesn't slow down and if XDarwin is running it does what it's supposed to.

Kim



[ Reply to This | # ]