Systemd 協同單元文件

Systemd 協同單元文件

我的 systemd 和 Unit 檔案有問題。

我使用的是 Ubuntu 16.04 Gnome Edition,我想在登入時啟動應用程式「synergy」。

經過一些研究,我了解到用戶單元文件儲存在~/.config/systemd/user/.

我建立了一個~/.config/systemd/user/synergy.service包含以下內容的單元檔案:

[Unit]
Description=Synergy

[Service]
Environment=DISPLAY=:1
ExecStart=/usr/bin/synergy

[Install]
WantedBy=default.target

我已經檢查了功能(它有效):

systemctl --user start synergy.service
systemctl --user status synergy.service

並啟用它:

systemctl --user enable synergy.service

不幸的是,重新啟動後,synergy.service 在我登入時不會啟動。

我認為我需要包含一個“after=”指令,以便在建立使用者會話時啟動單元檔案。

有誰有想法或其他方式在登入時使用 systemd 啟動應用程式?

感謝幫助

相關內容