Closed capriele closed 3 years ago
lo script hotplug per il restart di transmission forse è meglio contenga qualche check in più per evitare di riavviarlo quando si inserisce una seconda usb che magari non c'entra nulla con transmission
Something like that?
#!/bin/sh
usb_count=$(find /tmp/run/mountd/ -mindepth 1 -maxdepth 1 -type d | wc -l)
if [ "$usb_count" -le "1" ]; then
/etc/init.d/transmission restart
fi
However it should be checked when the usb is mounted. Because if it is mounted before the execution of this script the previous code doesn't work.
At the moment I only have a tg789vac (with only one USB port) so I can't do this check...
mhh yes or probably just a check for an if exist transmission folder on the mounted usb drive (should be an argument of hotplug script called)
-d /tmp/run/mountd/$DEVNAME/sharing/transmission
idk if is correct but something like this (hopefully it is already mounted when script is called)
mhh yes or probably just a check for an if exist transmission folder on the mounted usb drive (should be an argument of hotplug script called)
Ok, Is there a way to detect the latest mounted usb device?
This should be what you are searching for...
rethinking about this, probably i've introduced a misleading behaviour: restart will be not triggered on unmount (as the path does not exist) so transmission will continue to download to the "unmounted" path
rethinking about this, probably i've introduced a misleading behaviour: restart will be not triggered on unmount (as the path does not exist) so transmission will continue to download to the "unmounted" path
Yes, this could happen. Furthermore $DEVNAME
it is not equal to sda1
.
@FrancYescO the merged script is wrong: could this be a valid alternative?
#!/bin/sh
last_usb=$(ls -t /dev/sd* | tail -n 1)
last_usb=${last_usb#"/dev/"}
usb_count=$(find /tmp/run/mountd/ -mindepth 1 -maxdepth 1 -type d | wc -l)
if [ "$usb_count" == "0" ]; then
/etc/init.d/transmission restart
elif [ -d "/tmp/run/mountd/$last_usb/sharing/config/transmission" ]; then
/etc/init.d/transmission restart
fi
https://openwrt.org/docs/guide-user/base-system/hotplug#block
whats the value of $DEVNAME
? probably it should be used for the /mnt path
the other best bahaviour should be if action == remove && DEVNAME in transmission config > stop transmission
https://openwrt.org/docs/guide-user/base-system/hotplug#block whats the value of
$DEVNAME
? probably it should be used for the /mnt paththe other best bahaviour should be if action == remove && DEVNAME in transmission config > stop transmission
At the moment, on my device $DEVNAME is equal to: bus/usb/001/022
cat /sys/bus/usb/devices/usb1/1-2/uevent
MAJOR=189
MINOR=21
DEVNAME=bus/usb/001/022
DEVTYPE=usb_device
DRIVER=usb
DEVICE=/proc/bus/usb/001/022
PRODUCT=1221/3234/0
TYPE=0/0/0
BUSNUM=001
DEVNUM=022
closes: https://github.com/Ansuel/tch-nginx-gui/issues/1079 closes: https://github.com/Ansuel/tch-nginx-gui/issues/1078 Transmission/Amule/Aria2 restart trigger è rpc_whitelist