1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
.\"
.\" dbus-launch manual page.
.\" Copyright (C) 2003 Red Hat, Inc.
.\"
.TH dbus-launch 1
.SH NAME
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] [PROGRAM] [ARGS...]
.SH DESCRIPTION
The \fIdbus-launch\fP command is used to start \fIdbus-daemon-1\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
backticks or the $() construct can be used to read information from
\fIdbus-launch\fP.
With no arguments, \fIdbus-launch\fP will simply print the values of
DBUS_SESSION_BUS_ADDRESS and DBUS_SESSION_BUS_PID.
You may specify a program to be run; in this case, \fIdbus-launch\fP
will then set the appropriate environment variables and execute the
specified program, with the specified arguments. See below for
examples.
Finally, you may use the \-\-auto-syntax command to cause
\fIdbus-launch\fP to emit shell code to set up the environment. This
is useful in shell scripts. With this 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 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.
.PP
See http://www.freedesktop.org/software/dbus/ for more information
about D-BUS. See also the man page for \fIdbus-daemon-1\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
## 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 --auto-syntax --exit-with-session`
echo "D-BUS per-session daemon address is: $DBUS_SESSION_BUS_ADDRESS"
fi
.fi
You might run something like that in your login scripts.
.PP
Another way to use \fIdbus-launch\fP is to run your main session
program, like so:
.nf
dbus-launch gnome-session
.fi
The above would likely be appropriate for ~/.xsession.
.SH OPTIONS
The following options are supported:
.TP
.I "--auto-syntax"
Attempt to detect the shell in use, and emit compatible code.
.TP
.I "--csh-syntax"
Emit csh compatible code.
.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.
.TP
.I "--sh-syntax"
Emit Bourne-shell compatible code.
.TP
.I "--version"
Print the version of dbus-launch
.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,
see http://www.freedesktop.org/software/dbus/
|