3

TLDR:

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

Long:

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?

adrelanos
  • 1,836
  • 7
  • 30
  • 58

1 Answers1

-1

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

[Unit]
Requires=somesystemd.service
After=somesystemd.service

[Service]
ExecStart=/path/to/yourservice

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

[Install]
WantedBy=multi-user.target

Then run it with systemctl enable replacement.service.

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