How do I delay a program running at startup in the session settings app?

I have a VM that I want to delay 15 seconds so it can connect to Wi-Fi.
I use the session settings app on XFCE like this: “vboxmanage startvm ubuntu-20.04.3-live-server-amd64 --type headless”

What argument delays the program for 15 seconds? Instead of immediately.

1 Like

Add a sleep 15 && to the beginning, ex:

sleep 15 && vboxmanage startvm ubuntu-20.04.3-live-server-amd64 --type headless

Explanation:
sleep is a pause or rest … with the numerical argument being amount of time.
In this case ‘rest for 15 seconds’
&& is to mean ‘if the previous command finished successfully, then do this next thing’.
So we have ‘wait for 15 seconds and then do [your commands]’.

Funny they don’t start at all, I tried with 2 programs.

Its a pretty common procedure…

Maybe your autostarter wants full paths? ex:

/bin/sleep


EDIT:
Ah … xfce has a specific thing.
https://wiki.archlinux.org/title/Xfce#Autostart

So …

sh -c "sleep 15 && vboxmanage startvm ubuntu-20.04.3-live-server-amd64 --type headless"
2 Likes

Works, thank you!! I should’ve found that article.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.