2016-03-09 49 views
1

我真的試圖xflux添加爲systemd服務,使其啓動在啓動時,但是當我使用xflux和systemd在Debian傑西

# 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 

I`ve試圖表達ExecStart各種方式,如

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

ExecStart=/usr/bin/start-xflux 

'啓動流量' 是sh腳本用行:

exec /usr/bin/xflux -l 17 

Nothi ng工作。我總是從「systemctl地位」得到同樣的提示:

● 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 

從終端工作得很好。

你能幫忙嗎?

回答

0

你可能需要添加

[Service] 
Environment=DISPLAY=:0 

(或任何你DISPLAY號碼是,與echo $DISPLAY從shell中運行檢查的X會話下)。此外,您可能希望在systemd的用戶實例下運行此操作,而不是系統實例,即使用systemctl --user start xflux.service並將該單元放入~/.config/systemd/user/xflux.service

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