I'm trying to run a script when a device is connected. My udev and systemd files are loaded and triggered, but will only launch the script a single time. If I disconnect and reconnect the device, the script no longer launches. I have found that reloading systemctl at the end of my script will fix this issue (this method only works for 'user' systemd services). In previous version of Ubuntu, I was able to simply use udev with systemd, and it worked every time. It also didn't matter if I used either 'user' or 'system' service files. They both worked, which also allowed me to run commands as root.
I don't believe my script is the issue, as a simple file launch or notify-send command will only work after reloading systemctl (or if I reboot).
How can I use systemd where I don't have to constantly reload systemctl for it to work? Also if possible, how can I regain the systemd/system usage so I can run scripts as root?
Edit: I am using the desktop version of Ubuntu 20.04.
I have used the command systemctl status
and it showed that I had a failed service (wasn't my custom service file). I disabled the service and reloaded. No more failed services, but my original problem persists.