在Debian jessie上使用xflux和systemd

时间:2016-03-09 21:53:03

标签: debian x11 kde systemd

我正在尝试添加xflux作为systemd服务,以便它在启动时启动,但是当我使用

# systemctl start xflux.service 

它无法启动。我的xflux.service单元如下所示:

[Unit]
Description=xflux loader
After=display-manager.service

[Service]
Type=forking
ExecStart=/usr/bin/xflux -l 17
Restart=always

[Install]
WantedBy=graphical.target

我试图以各种方式表达ExecStart,比如

ExecStart=/bin/sh -c "/usr/bin/xflux -l 17"

ExecStart=/usr/bin/start-xflux

'启动磁通'是一个带有一行的sh脚本:

exec /usr/bin/xflux -l 17 

没有任何效果。我总是从' systemctl status':

获得相同的提示
● xflux.service - xflux loader
   Loaded: loaded (/etc/systemd/system/xflux.service; enabled)
   Active: failed (Result: start-limit) since śro 2016-03-09 21:53:47 CET; 43min ago
 Main PID: 4409 (code=exited, status=255)

mar 09 21:53:47 debian systemd[1]: Unit xflux.service entered failed state.
mar 09 21:53:47 debian xflux[4561]: [10B blob data]
mar 09 21:53:47 debian xflux[4561]: --------
mar 09 21:53:47 debian xflux[4561]: Welcome to xflux (f.lux for X)
mar 09 21:53:47 debian xflux[4561]: This will only work if you're running X on console.
mar 09 21:53:47 debian xflux[4561]: Guessing your longitude is 15.0 based on your timezone
mar 09 21:53:47 debian xflux[4561]: Specify it with -g to make things better.
mar 09 21:53:47 debian systemd[1]: xflux.service start request repeated too quickly, refusing to start.
mar 09 21:53:47 debian systemd[1]: Failed to start xflux loader.
mar 09 21:53:47 debian systemd[1]: Unit xflux.service entered failed state.

我也试过auto-xflux - 没有成功。我显然不明白xflux(" https://github.com/jamesan/auto-xflux"提示意味着什么?)或systemd。 我还应该添加调用

$ xflux -l 17
来自终端的

工作正常。

你能帮忙吗?

1 个答案:

答案 0 :(得分:1)

您可能需要添加

[Service] 
Environment=DISPLAY=:0

(或者您的DISPLAY号是什么,请在运行X会话的shell中使用echo $DISPLAY进行检查)。此外,您可能希望在systemd的用户实例而不是系统实例下运行它,即使用systemctl --user start xflux.service并将单位放在~/.config/systemd/user/xflux.service中。

https://wiki.archlinux.org/index.php/Systemd/User#DISPLAY_and_XAUTHORITY