[vox-tech] Re: Hello

Micah J. Cowan vox-tech@lists.lugod.org
Mon, 14 Oct 2002 11:20:44 -0700


On Mon, Oct 14, 2002 at 10:06:49AM -0700, Peter Jay Salzman wrote:
> arda,
> 
> i don't think inittab is the right thing here.
> 
> i'm not sure what the right answer is, but you can try to put this in
> your .xinitrc:
> 
> exec /usr/X11R6/bin/twm
> exec xterm -e opera
> 
> however, i think the problem here might be that twm doesn't return
> (until it finishes), so the next line won't get executed.  come to think
> of it, try this if the above doesn't work:
> 
> exec /usr/X11R6/bin/twm &
> exec xterm -e opera

Pete, the "exec" command is a shell built-in that means, "replace me
with this program". In your first example, even if the twm command
spawned the window manager and promptly exited (which would be
counter-intuitive for window manager behavior), the next line could
*never* execute, because the script is no longer being run (having
been replaced by twm due to the "exec").

The second example will "work", since the & tells the shell to first
spawn off a child shell in the background, and then *that* will get
replaced by twm; but it still has the probably undesirable effect that
X will terminate, not upon twm's exit, but upon opera's.

The way .xinitrc scripts work is: the X server runs that script, and
when the script exits, so does the X server. So, typically, you want
to spawn off all commands in your .xinitrc (with "&") except the very
last one. Usually this last one is executed with "exec", and is the
*only* command to get "exec" (the "exec" is entirely optional, but it
enables one less process to be spawned). Once that final command
exits, the script is done, so X quits.

Most of the time, the window manager (or desktop session manager) is
the last command, because that's the one whose termination should
cause X to quit. This is not the problem you might think it would be:
it's perfectly okay to start up X-dependant programs before the window
manager is up. A lot of the time, the window manager may already be up
before the preceding commands have opened a window; other times, there
may be a brief moment when they come up without a title bar, frame,
etc; but they will immediately receive them when the WM comes up.

So, if I were Arda, and I went the .xinitrc route, I'd probably have
it read:

opera & # There's no need for "xterm" - also, the full path
        #to opera would be preferable
exec /usr/X11R6/bin/twm

HTH, HAND.
-Micah

<snip rest of Pete's message>

> begin Arda Ulas Unlu <ardaulas@yahoo.com> 
> > Hello
> > Sorry for disturbing.
> > I want to write the command(s) to restart the xserver and at the next login I want the xserver to
> > open the Opera browser, as first job after the system is up. The inittab didn't work, (if it is
> > right to modify it).
> > 
> > Any help, suggestions are appreciated.