What's new

USB Disk Mounts Too Late - Deluge Creates Duplicate Mountpoint

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

bozolino

Occasional Visitor
at boot time my usb disk seems to mount AFTER the deluge bittorrent client starts. because deluge already writes to /mnt/DISKNAME at start point (creating a folder there in the process), my usb disk mounts to /mnt/DISKNAME(1) - breaking all paths in the process. how can i prevent this?
 
Start the bittorrent with a delay to allow your USB drive to fully boot.
 
How to do it. Can't he get it in? Here's an example for how to put, an up to 60 seconds time delay inside the Entware startup script.

/opt/etc/init.d/rc.unslung
Code:
#!/bin/sh

PATH=/opt/sbin:/opt/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

# Start/stop all init scripts in /opt/etc/init.d including symlinks
# starting them in numerical order and
# stopping them in reverse numerical order

#logger "Started $0${*:+ $*}."

ACTION=$1
CALLER=$2

if [ $# -lt 1 ]; then
    printf "Usage: $0 {start|stop|restart|reconfigure|check|kill}\n" >&2
    exit 1
fi

[ $ACTION = stop -o $ACTION = restart -o $ACTION = kill ] && ORDER="-r"

# wait up to 60 seconds to ensure that /opt partition is mounted
tmax=60
i=0
while [ $i -le $tmax ]; do
    if [ -d /opt/tmp ]; then
        break
    fi
    sleep 1
    let i++
done

for i in $(/opt/bin/find /opt/etc/init.d/ -perm '-u+x' -name 'S*' | sort $ORDER ) ;
do
    case "$i" in
        S* | *.sh )
            # Source shell script for speed.
            trap "" INT QUIT TSTP EXIT
            #set $1
            #echo "trying $i" >> /tmp/rc.log
            . $i $ACTION $CALLER
            ;;
        *)
            # No sh extension, so fork subprocess.
            $i $ACTION $CALLER
            ;;
    esac
done
 
thanks, fitz!

is it possible to put this "waiting loop" somewhere in /jffs/scripts ? i'm afraid that if i put it into /opt/etc/init.d/rc.unslung it will get overwritten by future entware updates...
 
got it:

in file /jffs/scripts/services-start

after this line
RC='/opt/etc/init.d/rc.unslung'

insert this code
### tmax=number of seconds to wait for partition to mount
tmax=60
i=0
while [ $i -le $tmax ]; do
if [ -d /mnt/YOURPARTITIONNAME ]; then
break
fi
sleep 1
let i++
done

now entware startup (which includes deluge startup) is delayed until my data partition is mounted. great!
 
How to do it. Can't he get it in? Here's an example for how to put, an up to 60 seconds time delay inside the Entware startup script.

/opt/etc/init.d/rc.unslung

Thought I remembered that one - still a nifty little trick...

(Bit of history - between the WRT54G and the NSLU2, there is so much DNA still left in modern devices that based on those two devices)
 

Similar threads

Latest threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top