Sponsored Content
Full Discussion: automount script
Top Forums Shell Programming and Scripting automount script Post 302263771 by unclecameron on Tuesday 2nd of December 2008 12:50:14 PM
Old 12-02-2008
well I hacked around last night and came up with this:

Code:
#!/bin/bash
#find the "# Added by KNOPPIX" line
grep -A 1 "KNOPPIX" etc/fstab | grep dev | cut -c1-9 > drivelist
# read a line at a time
cat drivelist | while read line;
do
        # increment a variable for sequential mount points
        let "a += 1"
        # make mountpoint
        mkdir -p "/scanmount/drive"$a
        # now mount that drive
        mount ${line} /scanmount/drive$a
done

but it doesn't work, I have to give it a fs type, which is more difficult because I have to search for all the letters between the 2nd and 3rd blank spaces on the same line to populate a fs type variable, and I can't seem to figure out how to get grep/sed/awk to do that, ideas? If I can figure that out, then I have to write something that will only mount if that mountpoint is either ntfs, fat16 or fat32. I'm really starting to enjoy the power of bash scripts, though I'm still pretty new to it, it's amazing what you can do 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
halmount(1)							   User Commands						       halmount(1)

NAME
halmount - mount and umount filesystems via hal SYNOPSIS
halmount [OPTIONS]... <device|label> [mountpoint] halmount -u [OPTIONS]... <device|label|mountpoint> halmount -e [OPTIONS]... <device|label|mountpoint> DESCRIPTION
halmount can mount and umount filesystems via hal. Hotpluggable devices and media such as USB sticks and CD-ROMs are typically not entered into /etc/fstab and are therefore not mountable by normal users via the mount(8) command. Instead hal provides methods to mount and umount such devices. Additionally it's also possible to eject devices. For devices like USB sticks eject means the device cannot be mounted again until the stick is re-plugged, ie a "save remove" feature. OPTIONS
-t TYPE specify the file system type to use -o OPTIONS specify mount options -v verbose listing of devices -u umount specified device -e umount and eject specified device -a perform requested mount/umount/eject operation all available devices --listudi list UDIs of devices, useful for debugging EXAMPLES
halmount list all mountable devices known to hal halmount /dev/hdc mount device hdc on default mount point (/media/volumelabel) halmount /dev/hdc cdrom mount device hdc on /media/cdrom halmount -u "Holiday Pictures" umount device that has the label "Holiday Pictures" SEE ALSO
mount(8), umount(8), eject(1), fstab(5) SUSE Linux November 2006 halmount(1)
All times are GMT -4. The time now is 09:48 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy