I've installed transmission-deamon
on Raspbian. I've set it up to directly download on to a NAS share, which is mounted at /home/pi/nas/public
via CIFS in /etc/fstab
.
All this generally works fine, except when the Pi restarts - either due to a power failure or any other reason - then transmission can't find any of the incomplete files and gives me that dreaded error..
No data found! Ensure your drives are connected or use "Set Location". To re-download, remove the torrent and re-add it.
I've tried to manually change the deamon startup delay from 30 to 60 in /etc/init.d/transmission-daemon
, but sometimes, I find that the share hasn't been mounted at all, even minutes after a reboot. Another reboot usually seems to fix this.
So here's what I wish to automate on startup..
- Wait 60 seconds to allow for all the shares to mount.
- Then, check for the existence of a file for eg.
/home/pi/nas/public/test.txt
, which is in the NAS. - If the file doesn't exist, it means the shares didn't mount. Go back to step 1.
- If the file exists, it means the shares mounted, so launch
transmission-deamon
.
Is this something that's possible with an init script?
To make it even more solid, perhaps a counter can be maintained that increments with each "file not found" reboot. If the counter exceeds 10, something is seriously wrong and an email should be sent to me.