Don't use Type=idle
– it was added specifically for the login prompt, and is about as reliable as a dice roll. Just declare the dependencies explicitly. (For a short-running script, Type=oneshot
is right.)
Your service communicates with libvirtd using virsh
, meaning it can only work when libvirtd is already running. Therefore:
[Unit] Requires=libvirtd.service After=libvirtd.service
(Adjust if your distribution calls the service differently.)
Also, self-disabling services might not be the best idea. Instead, you could use:
[Unit] ConditionPathExists=!/srv/virtual_machines