How to have an /etc/xdg/autostart/app.desktop service wait for a systemd service?


I have an app started by /etc/xdg/autostart/app.desktop that requires a systemd service to be started first.

I would like to avoid some sleep/wait/custom code if there is an existing tool for such purposes.

Is there some kind of wait_for_service_to_be_running <service-name> (systemd) command line tool?

1 Answer 1


Create yourservice.service file, place it into /etc/systemd/system/ and run systemctl start yourservice by your .desktop file.



Or you can replace app.desktop with systemd configuration. Create replacement.service as above with additional section:


Then run it with systemctl enable replacement.service.

Systemd service - what is `multi-user.target` can give more details.

  • /etc/xdg/autostart/ is for users when the desktop environment starts. /etc/systemd/system/ is for root.
    – adrelanos
    Commented Jan 27, 2019 at 5:57
  • @adrelanos systemd doesn't look into /etc/xdg/autostart - freedesktop.org/software/systemd/man/systemd.unit.html# Commented Jan 28, 2019 at 9:40
  • I am aware of that. My question remains the same.
    – adrelanos
    Commented Jan 31, 2019 at 5:02
  • I see. You don't want to rewrite desktop shortcut as a systemd service. Commented Feb 5, 2019 at 8:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .