LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 04-16-2010, 06:04 AM   #1
fopetesl
Member
 
Registered: Jan 2005
Location: Yorkshire Dales, UK
Distribution: Ubuntu 5.10; Mandriva 2007; Debian Lenny
Posts: 147

Rep: Reputation: 15
Question Bash defeated?


Ubuntu Breezy 5.10 (don't suggest an upgrade - it works!)

I'm trying to set up a script which updates some software on the hard drive from a directory on a USB Flash drive.

After I've plugged in the USB drive and seen it recognised by automount:

Code:
ls -l /vol/USBDISKB
OK - shows me the directory and files.

_BUT_

Code:
#!/bin/bash
 if [ -d /vol/USBDISKB ]; then
   echo "Found USB drive"
 else
   echo "Not found: USB drive!"
 fi
doesn't see the USB drive.

P.S. I also posted in LinuxExchange - maybe other gurus there
 
Old 04-16-2010, 06:19 AM   #2
smoker
Senior Member
 
Registered: Oct 2004
Distribution: Fedora Core 4, 12, 13, 14, 15, 17
Posts: 2,279

Rep: Reputation: 250Reputation: 250Reputation: 250
Try [ -b /vol/USBDISKB ]
 
Old 04-16-2010, 06:22 AM   #3
cola
Senior Member
 
Registered: Sep 2007
Posts: 1,045

Rep: Reputation: 65
Quote:
Originally Posted by fopetesl View Post
Ubuntu Breezy 5.10 (don't suggest an upgrade - it works!)

I'm trying to set up a script which updates some software on the hard drive from a directory on a USB Flash drive.

After I've plugged in the USB drive and seen it recognised by automount:

Code:
ls -l /vol/USBDISKB
OK - shows me the directory and files.

_BUT_

Code:
#!/bin/bash
 if [ -d /vol/USBDISKB ]; then
   echo "Found USB drive"
 else
   echo "Not found: USB drive!"
 fi
doesn't see the USB drive.

P.S. I also posted in LinuxExchange - maybe other gurus there
post:
Code:
ls -l /vol/
 
Old 04-16-2010, 06:46 AM   #4
fopetesl
Member
 
Registered: Jan 2005
Location: Yorkshire Dales, UK
Distribution: Ubuntu 5.10; Mandriva 2007; Debian Lenny
Posts: 147

Original Poster
Rep: Reputation: 15
Question And ..........?

Quote:
Originally Posted by cola View Post
post:
Code:
ls -l /vol/
 
Old 04-16-2010, 06:51 AM   #5
fopetesl
Member
 
Registered: Jan 2005
Location: Yorkshire Dales, UK
Distribution: Ubuntu 5.10; Mandriva 2007; Debian Lenny
Posts: 147

Original Poster
Rep: Reputation: 15
Angry Same. Same.

Quote:
Originally Posted by smoker View Post
Try [ -b /vol/USBDISKB ]
Same failure
 
Old 04-16-2010, 06:55 AM   #6
crts
Senior Member
 
Registered: Jan 2010
Posts: 2,020

Rep: Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757
Hi,

I think cola's intention is to check the permissions of /vol/USBDISKB. To also display the permissions of /vol
Code:
ls -al /vol
[EDIT]
Is this a script you just wrote or has it been working in the past?

Last edited by crts; 04-16-2010 at 06:59 AM.
 
Old 04-16-2010, 07:42 AM   #7
smoker
Senior Member
 
Registered: Oct 2004
Distribution: Fedora Core 4, 12, 13, 14, 15, 17
Posts: 2,279

Rep: Reputation: 250Reputation: 250Reputation: 250
I just tested a similar script on my machine and being fedora, it mounts the disk as owned by me.

Works perfectly with your settings.

Of course it gets mounted on media/usbdisk on fedora.

Is there a directory on the usbdisk you can check for instead of just the root directory ?
 
Old 04-16-2010, 07:58 AM   #8
fopetesl
Member
 
Registered: Jan 2005
Location: Yorkshire Dales, UK
Distribution: Ubuntu 5.10; Mandriva 2007; Debian Lenny
Posts: 147

Original Poster
Rep: Reputation: 15
Question

smoker:
Quote:
Is there a directory on the usbdisk you can check for instead of just the root directory ?
I aready tried that with
Code:
#!/bin/bash
if [ -e /vol/USBDISK/UPDATES/process.php ]; then
 echo "Found the file!"
else
 echo "Not found: process.php!"
fi
with same result.

permissions on almost all files and directories on the USB drive are 775 with root:users or root:root. That includes simply /vol
I already tried the same logged in as as root

Script has never succeeded. Is new code.
 
Old 04-16-2010, 08:02 AM   #9
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
It would help if you posted the output of /bin/ls -l /vol as requested and the output of df -hT too.
 
Old 04-16-2010, 08:24 AM   #10
fopetesl
Member
 
Registered: Jan 2005
Location: Yorkshire Dales, UK
Distribution: Ubuntu 5.10; Mandriva 2007; Debian Lenny
Posts: 147

Original Poster
Rep: Reputation: 15
Exclamation

Quote:
Originally Posted by catkin View Post
It would help if you posted the output of /bin/ls -l /vol as requested and the output of df -hT too.
ls -l /vol Difficult to do. Computer has no internet interface that works.

df -hT shows only hda1 & tmpfs.
 
Old 04-16-2010, 09:03 AM   #11
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Quote:
Originally Posted by fopetesl View Post
df -hT shows only hda1 & tmpfs.
Then the file system on the USB device is not mounted and ls -l /vol/USBDISKB is showing you files-and-directories on hda1 ???
 
Old 04-16-2010, 09:10 AM   #12
fopetesl
Member
 
Registered: Jan 2005
Location: Yorkshire Dales, UK
Distribution: Ubuntu 5.10; Mandriva 2007; Debian Lenny
Posts: 147

Original Poster
Rep: Reputation: 15
Exclamation

Quote:
Originally Posted by catkin View Post
Then the file system on the USB device is not mounted and ls -l /vol/USBDISKB is showing you files-and-directories on hda1 ???
No. ls -l /vol/USBDISKB shows me the files and directories on the USB drive.

Have used cp -f /vol/USBDISKB/process.php . for years to manually transfer data.

Just want to do it automagically.
 
Old 04-16-2010, 09:27 AM   #13
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Quote:
Originally Posted by fopetesl View Post
No. ls -l /vol/USBDISKB shows me the files and directories on the USB drive.
OK. Right now I do not understand how the file system on the USB drive has been mounted but the mount is not shown by the df command. The symptoms you have reported are unusual so we are looking for something unusual here ...
 
Old 04-16-2010, 10:45 AM   #14
fopetesl
Member
 
Registered: Jan 2005
Location: Yorkshire Dales, UK
Distribution: Ubuntu 5.10; Mandriva 2007; Debian Lenny
Posts: 147

Original Poster
Rep: Reputation: 15
Exclamation

Quote:
Originally Posted by catkin View Post
OK. Right now I do not understand how the file system on the USB drive has been mounted but the mount is not shown by the df command. The symptoms you have reported are unusual so we are looking for something unusual here ...
Note I said "automount" in my original post.
OK, could be confusing but it's listed when I do a ps -A | grep auto* as automount and uses a (text) file /etc/auto.vol which has instructions where to mount devices as and when they are connected.

AFAIK autofs isn't used here.
 
Old 04-16-2010, 11:00 AM   #15
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Quote:
Originally Posted by fopetesl View Post
Note I said "automount" in my original post.
OK, could be confusing but it's listed when I do a ps -A | grep auto* as automount and uses a (text) file /etc/auto.vol which has instructions where to mount devices as and when they are connected.

AFAIK autofs isn't used here.
When I dabbled with automount and it automounted file systems they were listed by df. Could it be that the automounting is not working? Can you post the content of /etc/auto.master and the /etc/auto.* files listed in it, presumably including (maybe only) /etc/auto.vol?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Using a long Bash command including single quotes and pipes in a Bash script antcore Linux - General 9 07-22-2009 11:10 AM
website blocker that can't be defeated by admin? newbiesforever Linux - Software 8 11-16-2008 08:54 PM
BASH -copy stdin to stdout (replace cat) (bash browser) gnashley Programming 4 07-21-2008 01:14 PM
why did bash 2.05b install delete /bin/bash & "/bin/sh -> bash"? johnpipe Linux - Software 2 06-06-2004 06:42 PM
reward (ive been defeated by linux) engineer55 Linux - Networking 45 06-27-2003 12:24 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 01:02 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration