Document that dbus-launch is not dbus-run-session
[platform/upstream/dbus.git] / doc / dbus-launch.1
index 0ea1949..4902b40 100644 (file)
 .\" 
-.\" dbus-launch manual page.
+.\" dbus\-launch manual page.
 .\" Copyright (C) 2003 Red Hat, Inc.
 .\"
-.TH dbus-launch 1
+.TH dbus\-launch 1
 .SH NAME
-dbus-launch \- Utility to start a message bus from a shell script
+dbus\-launch \- Utility to start a message bus from a shell script
 .SH SYNOPSIS
 .PP
-.B dbus-launch [\-\-version] [\-\-sh-syntax] [\-\-csh-syntax] [\-\-auto-syntax] [\-\-exit-with-session] [\-\-autolaunch=MACHINEID] [\-\-config-file=FILENAME] [PROGRAM] [ARGS...]
+.B dbus\-launch [\-\-version] [\-\-sh\-syntax] [\-\-csh\-syntax] [\-\-auto\-syntax] [\-\-exit\-with\-session] [\-\-exit\-with\-x11] [\-\-autolaunch=MACHINEID] [\-\-config\-file=FILENAME] [PROGRAM] [ARGS...]
 
 .SH DESCRIPTION
 
-The \fIdbus-launch\fP command is used to start a session bus 
-instance of \fIdbus-daemon\fP from a shell script.
+The \fIdbus\-launch\fP command is used to start a session bus 
+instance of \fIdbus\-daemon\fP from a shell script.
 It would normally be called from a user's login
-scripts. Unlike the daemon itself, \fIdbus-launch\fP exits, so
+scripts. Unlike the daemon itself, \fIdbus\-launch\fP exits, so
 backticks or the $() construct can be used to read information from
-\fIdbus-launch\fP.
+\fIdbus\-launch\fP.
 
-With no arguments, \fIdbus-launch\fP will launch a session bus
-instance and print the address and pid of that instance to standard
+With no arguments, \fIdbus\-launch\fP will launch a session bus
+instance and print the address and PID of that instance to standard
 output.
 
-You may specify a program to be run; in this case, \fIdbus-launch\fP
+You may specify a program to be run; in this case, \fIdbus\-launch\fP
 will launch a session bus instance, set the appropriate environment
 variables so the specified program can find the bus, and then execute the
 specified program, with the specified arguments.  See below for
 examples.
 
-If you launch a program, \fIdbus-launch\fP will not print the
+If you launch a program, \fIdbus\-launch\fP will not print the
 information about the new bus to standard output.
 
-When \fIdbus-launch\fP prints bus information to standard output, by
-default it is in a simple key-value pairs format. However, you may 
-request several alternate syntaxes using the \-\-sh-syntax, \-\-csh-syntax,
-\-\-binary-syntax, or
-\-\-auto-syntax options. Several of these cause \fIdbus-launch\fP to emit shell code
+When \fIdbus\-launch\fP prints bus information to standard output, by
+default it is in a simple key\-value pairs format. However, you may 
+request several alternate syntaxes using the \-\-sh\-syntax, \-\-csh\-syntax,
+\-\-binary\-syntax, or
+\-\-auto\-syntax options. Several of these cause \fIdbus\-launch\fP to emit shell code
 to set up the environment.
 
-With the \-\-auto-syntax option, \fIdbus-launch\fP looks at the value
+With the \-\-auto\-syntax option, \fIdbus\-launch\fP looks at the value
 of the SHELL environment variable to determine which shell syntax
-should be used.  If SHELL ends in "csh", then csh-compatible code is
+should be used.  If SHELL ends in "csh", then csh\-compatible code is
 emitted; otherwise Bourne shell code is emitted.  Instead of passing
-\-\-auto-syntax, you may explicity specify a particular one by using
-\-\-sh-syntax for Bourne syntax, or \-\-csh-syntax for csh syntax.
-In scripts, it's more robust to avoid \-\-auto-syntax and you hopefully
+\-\-auto\-syntax, you may explicitly specify a particular one by using
+\-\-sh\-syntax for Bourne syntax, or \-\-csh\-syntax for csh syntax.
+In scripts, it's more robust to avoid \-\-auto\-syntax and you hopefully
 know which shell your script is written in.
 
 .PP
 See http://www.freedesktop.org/software/dbus/ for more information
-about D-Bus. See also the man page for \fIdbus-daemon\fP.
+about D\-Bus. See also the man page for \fIdbus\-daemon\fP.
 
-.PP
-Here is an example of how to use \fIdbus-launch\fP with an 
-sh-compatible shell to start the per-session bus daemon:
-.nf
+.SH EXAMPLES
 
-  ## test for an existing bus daemon, just to be safe
-  if test -z "$DBUS_SESSION_BUS_ADDRESS" ; then
-      ## if not found, launch a new one
-      eval `dbus-launch --sh-syntax --exit-with-session`
-      echo "D-Bus per-session daemon address is: $DBUS_SESSION_BUS_ADDRESS"
-  fi
+Distributions running
+.B dbus\-launch
+as part of a standard X session should run
+.B "dbus\-launch \-\-exit\-with\-x11"
+after the X server has started and become available, as a wrapper around
+the "main" X client (typically a session manager or window manager), as in
+these examples:
 
-.fi
-You might run something like that in your login scripts.
+.RS
+.B "dbus\-launch \-\-exit\-with\-x11 gnome\-session"
 
-.PP
-Another way to use \fIdbus-launch\fP is to run your main session
-program, like so:
-.nf
+.B "dbus\-launch \-\-exit\-with\-x11 openbox"
 
-dbus-launch gnome-session
+.B "dbus\-launch \-\-exit\-with\-x11 ~/.xsession"
+.RE
 
+If your distribution does not do this, you can achieve similar results
+by running your session or window manager in the same way in a script
+run by your X session, such as
+.BR ~/.xsession ,
+.B ~/.xinitrc
+or
+.BR ~/.Xclients .
+
+To start a D-Bus session within a text-mode session, you can run
+dbus-launch in the background. For instance, in a sh-compatible shell:
+
+.nf
+  ## test for an existing bus daemon, just to be safe
+  if test \-z "$DBUS_SESSION_BUS_ADDRESS" ; then
+      ## if not found, launch a new one
+      eval `dbus\-launch \-\-sh\-syntax`
+      echo "D\-Bus per\-session daemon address is: $DBUS_SESSION_BUS_ADDRESS"
+  fi
 .fi
-The above would likely be appropriate for ~/.xsession or ~/.Xclients.
+Note that in this case, dbus-launch will exit, and dbus-daemon will not be
+terminated automatically on logout.
 
 .SH AUTOMATIC LAUNCHING
 
 .PP
 If DBUS_SESSION_BUS_ADDRESS is not set for a process that tries to use
-D-Bus, by default the process will attempt to invoke dbus-launch with
-the --autolaunch option to start up a new session bus or find the 
+D\-Bus, by default the process will attempt to invoke dbus\-launch with
+the \-\-autolaunch option to start up a new session bus or find the 
 existing bus address on the X display or in a file in
-~/.dbus/session-bus/
+~/.dbus/session\-bus/
 
 .PP
 Whenever an autolaunch occurs, the application that had to
@@ -114,70 +129,97 @@ DBUS_SESSION_BUS_ADDRESS. Autolaunch happens because the default
 address if none is set is "autolaunch:", so if any other address is
 set there will be no autolaunch. You can however include autolaunch in
 an explicit session bus address as a fallback, for example
-DBUS_SESSION_BUS_ADDRESS="something:,autolaunch:" - in that case if
+DBUS_SESSION_BUS_ADDRESS="something:,autolaunch:" \- in that case if
 the first address doesn't work, processes will autolaunch. (The bus
-address variable contains a comma-separated list of addresses to try.)
+address variable contains a comma\-separated list of addresses to try.)
 
 .PP
-The --autolaunch option is considered an internal implementation
+The \-\-autolaunch option is considered an internal implementation
 detail of libdbus, and in fact there are plans to change it. There's
 no real reason to use it outside of the libdbus implementation anyhow.
 
 .SH OPTIONS
 The following options are supported:
 .TP
-.I "--auto-syntax"
-Choose \-\-csh-syntax or \-\-sh-syntax based on the SHELL environment variable.
+.I "\-\-auto\-syntax"
+Choose \-\-csh\-syntax or \-\-sh\-syntax based on the SHELL environment variable.
 
-.I "--binary-syntax"
-Write to stdout a nul-terminated bus address, then the bus PID as a
+.I "\-\-binary\-syntax"
+Write to stdout a nul\-terminated bus address, then the bus PID as a
 binary integer of size sizeof(pid_t), then the bus X window ID as a
 binary integer of size sizeof(long). Integers are in the machine's
 byte order, not network byte order or any other canonical byte order.
 
 .TP
-.I "--close-stderr"
-Close the standard error output stream before starting the D-Bus
-daemon. This is useful if you want to capture dbus-launch error
-messages but you don't want dbus-daemon to keep the stream open to
+.I "\-\-close\-stderr"
+Close the standard error output stream before starting the D\-Bus
+daemon. This is useful if you want to capture dbus\-launch error
+messages but you don't want dbus\-daemon to keep the stream open to
 your application.
 
 .TP
-.I "--config-file=FILENAME"
-Pass \-\-config-file=FILENAME to the bus daemon, instead of passing it 
-the \-\-session argument. See the man page for dbus-daemon
+.I "\-\-config\-file=FILENAME"
+Pass \-\-config\-file=FILENAME to the bus daemon, instead of passing it 
+the \-\-session argument. See the man page for dbus\-daemon
 
 .TP
-.I "--csh-syntax"
+.I "\-\-csh\-syntax"
 Emit csh compatible code to set up environment variables.
 
 .TP
-.I "--exit-with-session"
-If this option is provided, a persistent "babysitter" process will be 
-created that watches stdin for HUP and tries to connect to the X
-server. If this process gets a HUP on stdin or loses its X connection,
-it kills the message bus daemon.
+.I \-\-exit\-with\-x11
+If this option is provided, a persistent "babysitter" process will be
+created, and will connect to the X server. If it cannot do so, launching
+fails. If the "babysitter" process loses its X connection,
+it kills the message bus daemon, disconnecting all of its clients (which
+should exit in response). This avoids having leftover daemon
+processes from a user X session, after the X session has ended.
+
+.TP
+.I \-\-exit\-with\-session
+If this option is provided, a persistent "babysitter" process will be
+created, as if for
+.BR \-\-exit\-with\-x11 .
+If it cannot connect to the X server, it will monitor the terminal from which
+.B dbus-launch
+was started instead, and if it gets a HUP on stdin, the message bus daemon
+will be killed. This option is not recommended, since it will consume input
+from the terminal where it was started; it is mainly provided for
+backwards compatibility.
 
 .TP
-.I "--autolaunch=MACHINEID"
-This option implies that \fIdbus-launch\fP should scan for a
-previously-started session and reuse the values found there. If no
+.I "\-\-autolaunch=MACHINEID"
+This option implies that \fIdbus\-launch\fP should scan for a
+previously\-started session and reuse the values found there. If no
 session is found, it will start a new session. The
-\-\-exit-with-session option is implied if \-\-autolaunch is given.
+\-\-exit\-with\-session option is implied if \-\-autolaunch is given.
 This option is for the exclusive use of libdbus, you do not want to
 use it manually. It may change in the future.
 
 .TP
-.I "--sh-syntax"
-Emit Bourne-shell compatible code to set up environment variables.
+.I "\-\-sh\-syntax"
+Emit Bourne\-shell compatible code to set up environment variables.
 
 .TP
-.I "--version"
-Print the version of dbus-launch
+.I "\-\-version"
+Print the version of dbus\-launch
+
+.SH NOTES
+
+If you run
+.B "dbus\-launch myapp"
+(with any other options), dbus\-daemon will
+.I not
+exit when
+.B myapp
+terminates: this is because
+.B myapp
+is assumed to be part of a larger session, rather than a session in its
+own right.
 
 .SH AUTHOR
 See http://www.freedesktop.org/software/dbus/doc/AUTHORS
 
 .SH BUGS
-Please send bug reports to the D-Bus mailing list or bug tracker,
+Please send bug reports to the D\-Bus mailing list or bug tracker,
 see http://www.freedesktop.org/software/dbus/