How to delay a startup service? [SOLVED]

Hi,

I have added Evolution to my Session and Startup panel (using Xfce), and it launches fine at startup. However, my wifi network connects a few seconds later so I end up having Evolution throw error messages about not connecting etc.

How do I delay (let’s say by 30 secs or 1 min) Evolution’s start or, better, make it depend on NetworkManager being up before starting?

Thanks for the answers!

It is a bit unsophisticated (a bigger hammer?) - but I would create a little script file to enable the startup with a delay - as I don’t think XFCE has the delay capability built in. Theoretically you could alternatively build it into the Exec= of Evolution’s .desktop file, but that would leave you with a delay every time you start it any other way!

The resulting file would be something like:

#!/bin/bash
sleep 15s
evolution

with you replacing ‘evolution’ with whatever command actually starts it up from a terminal. Make it executable (chmod +x scriptname) and point the Session and Startup entry to the script instead of the actual program. Hope this helps - if no-one drops by with a better way :grin:

4 Likes

Another possibility is to check the startup applications settings, e.g. MATE has this:

image

Not sure if Xfce has something similar, but then you can manually edit the launcher under $HOME/.config/autostart/ and set the Exec= line to include a sleep,

https://wiki.archlinux.org/index.php/xfce#Autostart

GNOME and MATE seem to have a better approach with X-GNOME-Autostart-Delay and X-MATE-Autostart-Delay launcher options…

4 Likes

Running KDE myself, would love to know how to accomplish this.

1 Like

You could probably do the same by creating a script file wherever you want it, then using KDE’s System Settings > Startup and Shutdown > Autostart and use the “Add Script” button.

2 Likes

On XFCE you have in Parameters/Session at start

For example to start my conky.desktop file that I created into ~/.config/autostart/ it appears in this GUI Session at start where you see the delay in second, here 5s

delay_service

2 Likes

Great for those apps that have a delay capability of their own! The

bash -c  "sleep 15 && command"

‘trick’ would be needed for this I think…

2 Likes

Thank you all for your great tips!

The easiest for me was to edit the autostart entry with

sh -c “sleep 15 && evolution”

Cheers!

2 Likes