That’s why using check-rtorrent-usb-disk.sh is IMHO better
Sure. But I see a problem here. Since rtorrent.service is wanted by multi-user.target, it will be started always. However, when in “USB-mode”, the start (and stop) of rtorrent should be controlled solely by check-rtorrent-usb-xxxx.sh. So what we see here is most likely that rtorrent is indeed started before the USB volume is mounted (due to dependency on multi-user.target). But after that – as a result of the USB attach event – check-rtorrent-usb-start.sh will kick in killing/restarting the already running rtorrent instance. Not very elegant. I think this can be avoided by simply disabling rtorrent.service (systemctl disable rtorrent.service) when USB operation is desired. But I would prefer having a single setting for that…
As for screen: No I have not tried. IMHO, it’s an ugly hack to work around design flaws of other programs (daemon-style apps that do not provide a proper daemon mode). AFAIK, rtorrent is the only one that uses it.
Well, let’s see if we can add additionnal time for this, maybe adding a pre_start command, ie something like
use usb disk && sleep 30s || direct start of service
I don’t know if it’s possible to still use our specific service that checks usb devices …
Anyway, it was on broken on kodi (trying to remove the disk from kodi doesn’t work)
for rtorrent, I can propose the patch but I need someone else to test it (without screen)