[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Need help in X Windows installation



On 12 Dec 1997, Sten Anderson wrote:

> Tommy Lakofski <tommy@88.net> writes:
> 
> Yes, by using exec to launch a command from a script, the process
> associated with the script (/bin/sh) is replaced by the process
> associated with the command. This saves a few system resources, since 
> the script process is not laying sleeping in the background for no
> purpose. The program pstree is an excellent tool to see the effect of
> this. However, the improvement of performance by this is barely
> measurable. I am simply arguing that while it is generally a good
> idea to uses exec, it is not that important, and certainly not
> required. In fact it might give you some unexpected effects, if exec
> is used on anything else than the last command in a script.   

But using exec is and has been the default way of starting the window
manager for years, so I don't think there is a real reason to change it.
Look at the last lines of /etc/X11/Xsession on any Debian system:

-----cut-here-----
if [ -x $startup ] && grep -q ^allow-user-xsession /etc/X11/config
then
  exec $startup
else
  xterm -ls &
  if [ -e /etc/X11/window-managers ]
  then
    for i in `sed 's/#.*//' /etc/X11/window-managers`
    do
      if [ -x $i ]
      then
        exec $i
      fi
    done
  fi
  if [ -x /usr/X11R6/bin/fvwm ]
  then
    exec fvwm
  fi
  exec twm
fi
-----cut-here-----

BTW, $startup is set to $HOME/.xsession earlier in the script.

What this does, is:

1. exec $HOME/.xsession , if it exists and is executable and is allowed to
be executed by the sysadmin. This means that the rest of this script is
not executed, just like you would expect. You do not want to exit your
`own' windows manager only to see the system-default window manager being
started.

2. If $HOME/.xsession does not exist, it first starts an xterm in the
background.

3. Then it checks /etc/X11/window-managers for a valid window manager. If
that exists, it is exec'ed and that is the last thing this script does.

4. If that fails, it first tries if an executable /usr/X11R6/bin/fvwm
exists. If it does, it is exec'ed and that is the last thing this script
does. 

5. If all the above have failed, twm is exec'ed without any test, as it is
in the same package (xbase) as this script and is most probably properly
configured (properly meaning that it runs without severe errors). Again,
that is the last thing this script does.

The above scheme of finding a window manager to launch _depends_ on the
behaviour of the `exec' command. In this case, it really is needed to keep
the script being readable.

Remco


--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-user-request@lists.debian.org . 
Trouble?  e-mail to templin@bucknell.edu .


Reply to: