Find the answer to your Linux question:
Results 1 to 10 of 10
Alright, I'm doing something like this: 1. Run a script from an external media device. 2. Have that script put another script into the $HOME folder. 3. Launch a script ...
  1. #1
    Linux User Agent-X's Avatar
    Join Date
    May 2005
    Location
    Dimension X
    Posts
    261

    A script ran from the device to unmount the device: I'm having problems

    Alright, I'm doing something like this:

    1. Run a script from an external media device.
    2. Have that script put another script into the $HOME folder.
    3. Launch a script from the $HOME folder to umount the device.

    Apparently, this sounds logical.
    For instance, the terminal is being told to launch the script from the home directory and not the device. I set these scripts up so that no script should be running from the device. Unfortunately, it seems as though something is running when nothing should be at all. I don't get why...

    If it's any consolation, I'm using Ubuntu. I've known Ubuntu to act a little different with terminal commands, so that might be something.

    File1.sh --> on external device
    Code:
    #!/bin/sh
    mkdir $HOME/folder
    cp -r ./folder/* $HOME/folder/
    bash $HOME/folder/rerouting.sh
    rerouting.sh ---> in $HOME/folder/

    Code:
    #!/bin/sh
    bash $HOME/folder/unmount-device.sh
    unmount-device.sh ---> in $HOME/folder/

    Code:
    #!/bin/sh
    sudo umount /dev/xyz*
    Despite the fact that it doesn't look like the last script is unmounting external device, I guess terminal thinks the device is active. To say the least, the device is not. I have nautilus closed during all of this. I just have a terminal window open.

    I think the device may be active because the terminal is somehow linking all of these scripts from the original one. If so, why doesn't it simply forget that it was previous at the first script, unload it, release it, and forget it even existed?

  2. #2
    Just Joined! minigeek's Avatar
    Join Date
    Sep 2005
    Location
    New Zealand
    Posts
    31
    Quote Originally Posted by Agent-X View Post
    Alright, I'm doing something like this:

    1. Run a script from an external media device.
    2. Have that script put another script into the $HOME folder.
    3. Launch a script from the $HOME folder to umount the device.

    Apparently, this sounds logical.
    For instance, the terminal is being told to launch the script from the home directory and not the device. I set these scripts up so that no script should be running from the device. Unfortunately, it seems as though something is running when nothing should be at all. I don't get why...

    If it's any consolation, I'm using Ubuntu. I've known Ubuntu to act a little different with terminal commands, so that might be something.

    File1.sh --> on external device
    Code:
    #!/bin/sh
    mkdir $HOME/folder
    cp -r /folder/* $HOME/folder/
    bash $HOME/folder/rerouting.sh
    rerouting.sh ---> in $HOME/folder/

    Code:
    #!/bin/sh
    bash $HOME/folder/unmount-device.sh
    unmount-device.sh ---> in $HOME/folder/

    Code:
    #!/bin/sh
    sudo umount /dev/xyz*
    Despite the fact that it doesn't look like the last script is running from the external device, I guess terminal thinks the device is active. To say the least, the device is not. I have nautilus closed during all of this. I just have a terminal window open.
    If you have used the following to mount

    Code:
     mount /dev/xyz /test
    Then to umount try

    Code:
    umount /test
    Instead of umount /dev/xyz

    Hope this helps

  3. #3
    Linux User Agent-X's Avatar
    Join Date
    May 2005
    Location
    Dimension X
    Posts
    261
    It didn't work.

  4. #4
    Just Joined! minigeek's Avatar
    Join Date
    Sep 2005
    Location
    New Zealand
    Posts
    31
    Quote Originally Posted by Agent-X View Post
    It didn't work.
    are you getting a error message?

  5. #5
    Linux User Agent-X's Avatar
    Join Date
    May 2005
    Location
    Dimension X
    Posts
    261
    Code:
    umount: /media/disk: device is busy
    umount: /media/disk: device is busy
    As a note, the device is automatically mounted when inserted into the USB port.
    The device did not manually require a mount command.

  6. #6
    Just Joined! minigeek's Avatar
    Join Date
    Sep 2005
    Location
    New Zealand
    Posts
    31
    Quote Originally Posted by Agent-X View Post
    Code:
    umount: /media/disk: device is busy
    umount: /media/disk: device is busy
    As a note, the device is automatically mounted when inserted into the USB port.
    The device did not manually require a mount command.
    Where does the umount-device.sh run from, from your pc or the device?

  7. #7
    Linux User Agent-X's Avatar
    Join Date
    May 2005
    Location
    Dimension X
    Posts
    261
    It runs from the PC.

    I feel as though things are going wrong because the process is going like this:

    external device (A) --> (B) --> (C)
    Instead of...

    external device (A) --> (B) PC
    PC (B) --> (C)
    However, I don't know why the process would be going from A to B to C (as in the first logical diagram).

    As another note, if I manually execute the script from the PC instead of the device, the script unmounts the device.
    That's why I've been feeling the scripts are somehow still pseudo-executing from the external device, which doesn't make sense.

    I guess it makes sense if there is a flaw in the way the shell is made.

  8. #8
    Just Joined! minigeek's Avatar
    Join Date
    Sep 2005
    Location
    New Zealand
    Posts
    31
    Quote Originally Posted by Agent-X View Post
    It runs from the PC.
    Looks like the drive is still being used. You will need to find what is using it

  9. #9
    Linux User Agent-X's Avatar
    Join Date
    May 2005
    Location
    Dimension X
    Posts
    261
    Impossible. I don't believe that.
    I've done this with a reboot of a live-cd.

    Is anyone able to do something like this with an external device?

  10. #10
    Linux Enthusiast
    Join Date
    Jul 2005
    Location
    Maryland
    Posts
    521
    Quote Originally Posted by Agent-X View Post
    Code:
    #!/bin/sh
    bash $HOME/folder/unmount-device.sh
    unmount-device.sh ---> in $HOME/folder/

    Code:
    #!/bin/sh
    sudo umount /dev/xyz*
    Despite the fact that it doesn't look like the last script is unmounting external device, I guess terminal thinks the device is active. To say the least, the device is not. I have nautilus closed during all of this. I just have a terminal window open.
    Where is it mounted? I hope not in the $HOME/folder, because if you cd to it and then try to unmount it it will throw "device is busy" error.

    Also,
    Code:
    umount -l /dev/xyz#
    should unmount it no matter what.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...