Tiny Core Base > Corepure64

Auto mount USB drive from .X.d Not Working

(1/4) > >>

pek:
Hi All,
I need another help again today :)

My aim:
1. To auto mount a USB drive with specific label name after X started.
2. run a script from from the USB.


What I did:
1. create a script to mount the USB /home/tc/mountUSB.sh

--- Code: ---sudo mkdir /tmp/theUSB
sudo mount -L theLABEL /tmp/theUSB
sh /tmp/theUSB/theSCRIPT.sh
--- End code ---

2. create a file to load it in /home/tc/.X.d/loadit

--- Code: ---exec /home/tc/mountUSB.sh &
--- End code ---


The problem:
**After boots up to X, the USB was not mounted.
But the /tmp/theUSB directory was successfully created.

**If I manually type exec "/home/tc/mountUSB.sh" in aterm, everything works perfectly and the script within the USB was launched successfully.

Can anyone help me on this please?
Thank you.

Rich:
Hi pek
Try it like this:

--- Code: ---#!/bin/sh
--- End code ---

--- Code: ---sudo mkdir /tmp/theUSB
--- End code ---

--- Code: ---drive="`/sbin/blkid -lt LABEL=theLABEL -o device`"
--- End code ---

--- Code: ---sudo mount "$drive" /tmp/theUSB
--- End code ---

--- Code: ---/tmp/theUSB/theSCRIPT.sh
--- End code ---

Make  /home/tc/.X.d/loadit  look like this:

--- Code: ---/home/tc/mountUSB.sh &
--- End code ---

pek:
Hi Rich, thanks for your suggestion.
However it behaves exactly the same like the original.

**After boots up to X, the USB was not mounted.
But the /tmp/theUSB directory was successfully created.

**when I type exec ./.X.d/loadit in aterm, everything works perfectly and the script within the USB was launched successfully.

Rich:
Hi pek
Try adding a  sync  command after the  mkdir  line.
Also, make sure your script is executable:

--- Code: ---chmod 775 /home/tc/mountUSB.sh
--- End code ---

curaga:
Remove the exec, it may block anything after it from running.

Navigation

[0] Message Index

[#] Next page

Go to full version