| Creating a systemd unit that runs when Dom0 user logs in (NOT merely when boot up completes) | daltong defourne | 24/03/18 11:20 | Hello community! I need to achieve the following: A systemd unit that fires ONLY when user first logs in (not when bootup complete, so rc.local does not achieve what I want) And, related need, I want to be able to determine if a particular VM is already running. What I want to achieve: sequential VM startup that does not rely on "start automatically" facilities of Qubes R3.2, that only fires after user logs in, and then starts a shell script that does the following: 1) check if a particular autostarty VM is already running (timeout and self-terminate with error if it is not running for 30 seconds after login) 2) when the VM is detected as running start VM2 3) wait for it to start, re-check for its running status (as in point 1) 4) start VM 3 Help very appreciated :) |
| Re: [qubes-users] Creating a systemd unit that runs when Dom0 user logs in (NOT merely when boot up completes) | Ivan Mitev | 24/03/18 12:07 | Hey,
Found that (didn't even know that was possible): https://superuser.com/questions/1037466/how-to-start-a-systemd-service-after-user-login-and-stop-it-before-user-logout/1269158 I usually start stuff after logon with: - the WM's autostart feature ( $HOME/.config/autostart/blah.desktop ) - or a system-wide .desktop file in /etc/xdg/autostart I haven't tested if you can start systemd units from such scripts though (issues with namespaces ?) but what you describe below can be achieved with simple qvm-* commands. |
| Re: [qubes-users] Creating a systemd unit that runs when Dom0 user logs in (NOT merely when boot up completes) | steve.coleman | 26/03/18 09:32 | If you are using lightdm you might look at the "session-setup-script"
setting and see if it can handle what you want. I have mine prompting the user with a simple zenity dialog at logon, but yours is a bit more complicated, so your mileage my vary significantly. Mine appears to block processing to wait for a user action but yours could take a significant amount of time during VM start up, but it may be acceptable in your specific usec-ase. /usr/share/lightdm/lightdm.conf.d/*.conf $ grep session-setup-script \ /usr/share/lightdm/lightdm.conf.d/60-lightdm-gtk-greeter.conf session-setup-script=/usr/local/bin/do-what-i-want-script |