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

Re: Start only one program at login



On 24Jan2007 20:41, Kanwar Ranbir Sandhu <m3freak rogers com> wrote:
| On Thu, 2007-01-25 at 10:20 +1100, Cameron Simpson wrote:
| > Get rid of the "&".
| > 
| > The duration of the .xsession script is the duration of your login.
| > Normally you would kick off a few things in the background with "&"
| > (terminals, browsers, whatever) and finally start a window manager
| > _without_ an "&". In this way the script is waiting for the window
| > manager - quitting the window manager logs you out.
| > 
| > So you want to start a single app _instead_ of a window manager.
| 
| Thank - that's the explanation I was looking for.  I should have
| realized that backgrounding the  terminal wasn't what I wanted to do.
| 
| Here's what I ended up doing:
| 
| exec /usr/bin/metacity --sm-disable &
| exec /usr/bin/gnome-terminal --window --full-screen
| 
| I think I'm doing that right.  I'm not sure if I should have two exec
| lines.  It is working though: when I exit the gnome-terminal, I get
| logged out, which is exactly what I wanted.

Good.

You don't need two exec lines. You don't even need one:-)

Using "exec" _replaces" the shell running the script with the program
being called. Normally the called program is a child of the shell. For
the last program in a script it can be a tiny performance win to exec
it, since the shell is no longer needed.

Using "exec" with a "&" is harmless but also useless.

So I would write:

  metacity --sm-disable &
  exec gnome-terminal --window --full-screen

I normally try to avoid full pathnames to executables - things will just
break if the system layout is changed. Do you type full paths at your
shell prompt? Rarely I would hope:-) Scripts are no different.

Cheers,
-- 
Cameron Simpson <cs zip com au> DoD#743
http://www.cskk.ezoshosting.com/cs/


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