dbus-launch(转)
*NAME*
dbus-launch - Utility to start a message bus from a shell script
dbus-launch - 从shell脚本启动一个消息总线的工具(实用程序)
URL
http://dbus.freedesktop.org/doc/dbus-launch.1.html
SYNOPSIS
dbus-launch [--version ] [--help ] [--sh-syntax ] [--csh-syntax ] [--auto-syntax ] [--binary-syntax ] [--close-stderr ] [--exit-with-session ] [--autolaunch=MACHINEID] [--config-file=FILENAME] [PROGRAM] [ARGS...]
DESCRIPTION
The dbus-launch command is used to start a session bus instance of dbus-daemon from a shell script.
dbus-launch 命令用于从shell脚本启动一个 dbus-daemon 的会话总线实例.
It would normally be called from a user's login scripts.
dbus-launch 命令通常会在用户的登录脚本中调用.
Unlike the daemon itself, dbus-launch exits, so backticks or the \(() construct can be used to read information from dbus-launch.
与守护进程不同, 如果 dbus-launch 退出, 那么可以使用反引号或者\)()结构从dbus-launch中读取信息.
With no arguments, dbus-launch will launch a session bus instance and print the address and pid of that instance to standard output.
如果没有参数, dbus-launch 会加载一个会话总线实例,并且把地址和实例的pid打印到标准输出.
You may specify a program to be run; in this case,
dbus-launch will launch a session bus instance,
你可以指定一个程序运行; 在这种情况下, dbus-launch 会加载一个会话实例,
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, dbus-launch will not print the information about the new bus to standard output.
如果你加载一个程序, dbus-launch 不会在标准输出打印新总线的信息.
When dbus-launch prints bus information to standard output,
by default it is in a simple key-value pairs format.
当dbus-launch在标准输出打印bus信息时, 默认情况下是简单的key-value pairs格式.
However, you may request several alternate syntaxes using the --sh-syntax,
--csh-syntax, --binary-syntax, or --auto-syntax options.
当然, 你可以请求几个可替换的语法 通过使用--sh-syntax, --csh-syntax, --binary-syntax, 或者 --auto-syntax 选项.
Several of these cause dbus-launch to emit shell code to set up the environment.
其中几个会引起dbus-launch发送shell code来设置环境.
With the --auto-syntax option, dbus-launch looks at the value of the SHELL environment variable
to determine which shell syntax should be used.
使用--auto-syntax 选项, dbus-launch 会根据SHELL环境变量来决定使用哪一个shell语法.
If SHELL ends in "csh", then csh-compatible code is emitted; otherwise Bourne shell code is emitted.
如果SHELL 以"csh" 结尾, 那么会发送 csh-compatible code; 否则会发送Bourne shell code.
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.
如果不使用 --auto-syntax选项, 你可以明确的指定一个,
--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.
在脚本中, 避免使用 --auto-syntax 会增加脚本的健壮性,并且你也希望知道你的脚本写在什么shell中.
See http://www.freedesktop.org/software/dbus/ for more information about D-Bus.
See also the man page for dbus-daemon.
EXAMPLES
Here is an example of how to use dbus-launch with an sh-compatible shell to start the per-session bus daemon:
下面是一个如何使用dbus-launch的例子, 使用一个sh-compatible shell来启动每会话总线守护进程:
## 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
You might run something like that in your login scripts.
你可以在你的登录脚本中运行类似的命令.
Note that in this case, dbus-launch will exit, and dbus-daemon will not be terminated automatically on logout.
在这个例子中,需要注意的是dbus-launch会退出,但是dbus-daemon在登出会自动结束.
Another way to use dbus-launch is to run your main session program, like so:
另一种使用dbus-launch的方法是运行你的主会话程序, 像下面这样:
Distributions running dbus-launch as part of a standard X session should run dbus-launch --exit-with-session 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:
dbus-launch --exit-with-session gnome-session
dbus-launch --exit-with-session openbox
dbus-launch --exit-with-session ~/.xsession
The above would likely be appropriate for ~/.xsession or ~/.Xclients.
上面的用法应当在 ~/.xsession 和 ~/.Xclients 文件中使用.
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 ~/.xsession
,~/.xinitrc
or ~/.Xclients
.
AUTOMATIC LAUNCHING
If DBUS_SESSION_BUS_ADDRESS is not set for a process that tries to use D-Bus,
如果没有为一个要使用D-Bus的进程设置 DBUS_SESSION_BUS_ADDRESS,
by default the process will attempt to invoke dbus-launch with the --autolaunch option to start up a new session bus
默认情况下,这个进程会试图使用--autolaunch选项执行dbus-launch来启动一个新的会话,
or find the existing bus address on the X display or in a file in ~/.dbus/session-bus/
或者寻找在X display上或目录(~/.dbus/session-bus/)下文件中 存在的总线地址.
Whenever an autolaunch occurs, the application that had to start a new bus will be in its own little world;
每当一个autolaunch发生,需要启动一个新总线的应用会在自己的小世界中;
it can effectively end up starting a whole new session if it tries to use a lot of bus services.
如果应用想要使用很多的总线服务,这种方式有效的启动一个全新的会话.
This can be suboptimal or even totally broken, depending on the app and what it tries to do.
这种方式是次优甚至毁灭性的, 这取决于app和他想要做什么.
There are two common reasons for autolaunch.
使用autolaunch有2个通常的原因.
One is ssh to a remote machine.
一个是ssh来远程计算机.
The ideal fix for that would be forwarding of DBUS_SESSION_BUS_ADDRESS in the same way that DISPLAY is forwarded.
In the meantime, you can edit the session.conf config file to have your session bus listen on TCP,
在此期间, 你可以编辑 session.conf 配置文件来使你的session bus 监听TCP,
and manually set DBUS_SESSION_BUS_ADDRESS, if you like.
如果你愿意,你可以手动设置 DBUS_SESSION_BUS_ADDRESS.
The second common reason for autolaunch is an su to another user,
第二个原因是超级用户对于另一个用户,
and display of X applications running as the second user on the display belonging to the first user.
并且X应用的显示作为第二个用户运行在属于第一个用户的的display上.
Perhaps the ideal fix in this case would be to allow the second user to connect to the session bus of the first user,
也可以这个case可能允许第二个用户连接到第一个用的会话总线上,
just as they can connect to the first user's display. However, a mechanism for that has not been coded.
就像和他可以连接到第一个用户的display上, 但是这种结构没有实现.
You can always avoid autolaunch by manually setting DBUS_SESSION_BUS_ADDRESS.
你总是可以通过手动设置DBUS_SESSION_BUS_ADDRESS来避免autolaunch.
Autolaunch happens because the default address if none is set is "autolaunch:",
Autolaunch发生是因为默认的地址中
so if any other address is set there will be no autolaunch.
所以如果设置有任何其他地址,就不会发生autolaunch.
You can however include autolaunch in an explicit session bus address as a fallback,
然而你可以在总线地址中包含autolaunch作为备选方案,
for example DBUS_SESSION_BUS_ADDRESS="something:,autolaunch:"
in that case if the first address doesn't work, processes will autolaunch.
这种情况下,如果第一个地址不能正常工作,进程就会autolaunch.
(The bus address variable contains a comma-separated list of addresses to try.)
总线地址变量是一个使用逗号分隔的可以尝试使用的地址列表.
The --autolaunch option is considered an internal implementation detail of libdbus, and in fact there are plans to change it.
--autolaunch选项被认为是libdbus一个内部实现详细, 并且实际上计划要改变它.
There's no real reason to use it outside of the libdbus implementation anyhow.
总之没有任何原因在libdbus实现外使用 --autolaunch选项.
OPTIONS
The following options are supported:
dbus-launch命令支持下面的选项:
--auto-syntax
Choose --csh-syntax or --sh-syntax based on the SHELL environment variable.
根据环境变量SHELL的值自动选择使用--csh-syntax 或者 --sh-syntax.
--binary-syntax
Write to stdout a nul-terminated bus address,
--binary-syntax 向stdout写一个null结尾的bus地址字符串,
then the bus PID as a binary integer of size sizeof(pid_t),
跟着是总线PID,大小是sizeof(pid_t)二进制整型.
then the bus X window ID as a binary integer of size sizeof(long).
再跟着是这个总线的 X window ID,大小是sizeof(long)二进制整型.
Integers are in the machine's byte order, not network byte order or any other canonical byte order.
整形是使用机器的字节序,不是网络字节序或者其他标准的字节序.
--csh-syntax
Emit csh compatible code to set up environment variables.
发送csh兼容码设置环境变量
--sh-syntax
Emit Bourne-shell compatible code to set up environment variables.
发送Bourne-shell兼容码设置环境变量
--close-stderr
Close the standard error output stream before starting the D-Bus daemon.
启动D-Bus 守护进程前关闭标准输出流.
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.
如果你想捕获dbus-launch错误消息,但是不想dbus-daemon保持流对对应用的开放,这会使非常有用的.
--config-file=FILENAME
Pass --config-file=FILENAME to the bus daemon, instead of passing it the --session argument.
通过将配置文件FILENAME传给 bus daemon 来代替 --session argument.
See the man page for dbus-daemon
--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.
如果提供了这个选项, 会创建一个持续的 "babysitter"进程用于监视stdin 中的 HUP信息, 并且试着连接到 X server.
If this process gets a HUP on stdin or loses its X connection, it kills the message bus daemon.
如果这个进程在stdin中获得了HUP或者丢失了他的 X connection, 他会终止消息总线的守护进程.
--autolaunch=MACHINEID
This option implies that dbus-launch should scan for a previously-started session and reuse the values found there.
这个选项意味着dbus-launch应该扫描先前启动的session并且复用在那发现的值.
If no session is found, it will start a new session.
如果没有找到会话, 他会启动一个新的会话.
The --exit-with-session option is implied if --autolaunch is given.
如果提供了--atuolaunch选项, --exit-with-session选项也默认开启.
This option is for the exclusive use of libdbus, you do not want to use it manually. It may change in the future.
这个选项是为libdbus独有的, 你不会想要手动使用这个选项.
--version
Print the version of dbus-launch
NOTES
If you run dbus-launch myapp (with any other options), dbus-daemon will not exit when myapp terminates:
this is because myapp is assumed to be part of a larger session, rather than a session in its own right.
如果你运行下面这样的指令(和其他任何选项),
dbus-launch myapp
当myapp结束时,dbus-daemon也不会退出,这是因为myapp被认为是一个大的会话的一部分,而不是一个在自己权限中的会话.
转自:https://www.cnblogs.com/LubinLew/p/dbus_launch.html
dbus-launch(转)的更多相关文章
- D-BUS详细分析
转:http://blog.csdn.net/yclzh0522/article/details/7090599 一.概述 官方网站:http://www.freedesktop.org/wiki/S ...
- Dbus组成和原理
DBUS是实质上一个适用于桌面应用的进程间的通讯机制,即所谓的IPC机制.适合在同一台机器,不适合于INTERNET的IPC机制.DBUS不是一个为所有可能的应用的通用的IPC机制,不支持其他IPC机 ...
- 从需求去理解 Linux dbus与基于dbus协议的无agent软件管理
What is IPC IPC [Inter-Process Communication] 进程间通信,指至少两个进程或线程间传送数据或信号的一些技术或方法.在Linux/Unix中,提供了许多IPC ...
- 高级IPC DBus
What is IPC IPC [Inter-Process Communication] 进程间通信,指至少两个进程或线程间传送数据或信号的一些技术或方法.在Linux/Unix中,提供了许多IPC ...
- 在Linux(Luna)下向Launch启动器中添加图标
记录下在Luna下向Launch中添加图标的步骤,以供以后参考,这里我以加入eclipse图标为例: 首先,我们来创建一个desktop文件(Luna中到启动器Launch可以看作是Ubuntu中到桌 ...
- 从 Everything 到 Listary,自 Launch 归 Wox
人生即在于体验,而体验源于去尝试,去折腾,去改变,去塑新.要知道:"过一个平凡无趣的人生实在太容易了,你可以不读书,不冒险,不运动,不写作,不外出,不折腾--但是,人生最后悔的事情就是:我本 ...
- iPhone屏幕尺寸/launch尺寸/icon尺寸
屏幕尺寸 6p/6sp 414 X 736 6/6s 375 X 667 5/5s 320 X 568 4/4s 320 X 480 la ...
- Jenkins 2.16.3默认没有Launch agent via Java Web Start,如何配置使用
问题:Jenkins 2.16.3默认没有Launch agent via Java Web Start,如下图所示,而这种启动方式在Windows上是最方便的. 如何设置才能让出来呢? 打开&quo ...
- Launch和Shut Off操作详解 - 每天5分钟玩转 OpenStack(30)
本节详细分析 instance launch 和 shut off 操作,以及如何在日志中快速定位有用信息的技巧. Launch Launch instance 应该算 Nova 最重要的操作. 仔细 ...
- 解决:ERROR: Cannot launch Jack server
问题重现: Install: /home/dinphy/sm/out/target/product/ido/system/lib/libdl.so java -Xmx3500m -jar /home/ ...
随机推荐
- Cookie、Session、Token
一.发展史 .最初.Web基本上就是文档的浏览而已,既然是浏览,作为服务器,不需要记录谁在某一段时间里都浏览了什么文档,每次请求都是一个新的HTTP协议,就是请求加相应,尤其是我不用记住是谁刚刚发了H ...
- java 实现模拟浏览器 访问网站
一般的情况下我们都是使用IE或者Navigator浏览器来访问一个WEB服务器,用来浏览页面查看信息或者提交一些数据等等.所访问的这些页面 有的仅仅是一些普通的页面,有的需要用户登录后方可使用,或者需 ...
- Eigen库和STL容器冲突问题
博客参考:https://blog.csdn.net/huajun998/article/details/54311561 在程序中想使用类似于如下的容器 std::vector<Eigne:: ...
- python类和元类
python 类和元类详解 小麦麦子 2016-09-06 11:11:00 今天在网上看到一篇关于python语言中类和元类(metaclass)的一些讲解和简单运用,感觉对pyth ...
- rsync同步常用命令[转载]
转载:http://blog.csdn.net/niushuai666/article/details/16880061 如果你是一位运维工程师,你很可能会面对几十台.几百台甚至上千台服务器,除了批量 ...
- 博客搬家到blog.wu8685.com
博客园算是我最开始来的地方了吧,当时还在学校,为了找工作会看一些理论方面的东西,所以写的都是偏理论的心得. 后来参加了工作,开始忙起来,也就没有时间来更新了.其实忙都是借口,这点还是需要反思的. 大概 ...
- [Training Video - 7] [Database connection] Part 1
try, catch and finally in db connection Forming groovy connection string and obtaining Connection Ob ...
- Java 设计模式系列(十五)观察者模式(Observer)
Java 设计模式系列(十五)观察者模式(Observer) Java 设计模式系列目录(https://www.cnblogs.com/binarylei/p/10198698.html) Java ...
- shell 用环境变量的值修改properties文件
假设有如下属性文件 demo.properties user.name=test user.password=123456 ............................... 需求:先需要 ...
- Redis持久化(八)
Redis特性: (1)多数据库 (2)Redis事物 (3)一个Redis最多可提供16个数据库,下标[0-15] 选择数据库: select 1 (选择1号数据库,默认连接的是0号数据库)移动数据 ...