Sponsored Content
Full Discussion: automount script
Top Forums Shell Programming and Scripting automount script Post 302264061 by unclecameron on Wednesday 3rd of December 2008 04:13:37 AM
Old 12-03-2008
Ok, I got it working Smilie Thanks a lot for your help!

Code:
#!/bin/bash

# find the "# Added by KNOPPIX" line
# and pipe the output to a loop
sed -n '/^\s*#/{N;s/^#.*\n//p}' /etc/fstab \
| while read device mountpoint filesystem options junk
# now we have a list of our mount information
do
    while [ "$filesystem" = "ntfs" ]
        do
        # increment drive mount variable
        let "a += 1"
        # make the sequential mount location
        mkdir -p "/scanmount/drive"$a
        # now mount that drive at the dir we just made
        mount $device -t $filesystem "/scanmount/drive"$a
        # reset filesystem variable
        filesystem="1"
        done
    while [ "$filesystem" = "fat32" ]
        do
        # increment drive mount variable
        let "a += 1"
        # make the sequential mount location
        mkdir -p "/scanmount/drive"$a
        # now mount that drive at the dir we just made
        mount $device -t $filesystem "/scanmount/drive"$a
        # reset filesystem variable
        filesystem="1"    
        done
    while [ "$filesystem" = "fat16" ]
        do
        # increment drive mount variable
        let "a += 1"
        # make the sequential mount location
        mkdir -p "/scanmount/drive"$a
        # now mount that drive at the dir we just made
        mount $device -t $filesystem "/scanmount/drive"$a
        # reset filesystem variable
        filesystem="1"
        done
done

though I'm sure there's a better way to do my nested while loops Smilie
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

automount

I install an external disk on my sun solaris 8 this went fine and I was able to access all filesystem on the disk. the new disk is mounted on /local then 6 hours later files under /local/files was 1 byte in size at the same time I received the following error message in... (4 Replies)
Discussion started by: hassan2
4 Replies

2. UNIX for Advanced & Expert Users

Automount

My site has a few sun solaris server including out NIS server and NFS server on solaris machines. we also have few suse linux and redhat linux machine. All our home directory is on our NFS server(sun Solaris) and this is automounted through /etc/auto_master and /etc/auto_home this worked fine... (1 Reply)
Discussion started by: hassan2
1 Replies

3. UNIX for Advanced & Expert Users

AutoMount

Hi All How do I do a auto mount to a directory in a different unix server. I am using Solaris. Please advise!! TIA Jana (7 Replies)
Discussion started by: janavenki
7 Replies

4. Solaris

CD automount does not work

Hello, I have a SUN Solaris 9 machine (Sun-Fire-V490). I put a DVD in the reader to install a software. The automount procedure did not work (vold is running) : I have nothing under /cdrom When I try "eject" command I have the answer "No default media available" When I try to mount manually the... (3 Replies)
Discussion started by: aribault
3 Replies

5. UNIX for Dummies Questions & Answers

Automount issue

Folks; I'm mounting a directory on a different SUSE 10 server from my SUSE server fine. using this mount command: # mount 192.168.132.11:/var/local/new /var/local/new this command above works fine but when i added a new line to my "/etc/fstab" to be mounted automatically every time i... (2 Replies)
Discussion started by: Katkota
2 Replies

6. Solaris

Automount in Solaris 10

Hi friends I'm a newbie trying to automount a nfs shared directory. Below is the configuration I'm using FreeBSD machine as NFS server. IP Address - 192.168.1.60 # cat /etc/exports /shared 192.168.1.50 Solaris 10 as NFS client. IP Address - 192.168.1.50 # cat... (1 Reply)
Discussion started by: pankajj
1 Replies

7. AIX

Help on Unconfiguring Automount

Hi All, Please help. I need an advise on how to Unconfigure automount please. Many Thanks. (2 Replies)
Discussion started by: EngnrRG
2 Replies

8. Linux

Automount problem

Hi, Please give step by step how to do automount in linux Thanks, Mani (9 Replies)
Discussion started by: Mani_apr08
9 Replies

9. Red Hat

Automount in RHEL

Hello experts, On my RHEL box when i mount a nfs file system using autofs, the df -t shows the file system as nfs only. For which mounts does it report the filesystem as autofs. ?? I actually want to see the filesystem getting reported as autofs instead of nfs. Pls guide me I... (1 Reply)
Discussion started by: achak01
1 Replies

10. Red Hat

Need help with automount.. is not working!!

When i export the directory where the data really is, i can specify which hosts can mount it. On the remote server i create a mount point directory and then mount it to the source servers directory (that has the data). I need to run my script on Server X , i would login there and type in the... (11 Replies)
Discussion started by: bkilaru
11 Replies
All times are GMT -4. The time now is 11:55 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy