Find the answer to your Linux question:
Results 1 to 7 of 7
Code: #!/bin/sh # # stupid mounting script # ########################## MNT='/sbin/mount' OPT='-t cifs -o username=myname,workgroup=workgroup,rw,uid=1000,gid=100' REMOTE_MEDIA_FILES='//server/Media Files' MEDIA_MNTPNT='/home/media' $MNT $OPT $REMOTE_MEDIA_FILES $MEDIA_MNTPNT Why doesn't this work? It just gives me this ...
  1. #1
    Just Joined!
    Join Date
    Oct 2005
    Posts
    20

    script won't use mount as command or just refuses to work

    Code:
    #!/bin/sh
    #
    # stupid mounting script
    #
    ##########################
    
    MNT='/sbin/mount'
    OPT='-t cifs -o username=myname,workgroup=workgroup,rw,uid=1000,gid=100'
    REMOTE_MEDIA_FILES='//server/Media Files'
    MEDIA_MNTPNT='/home/media'
    
    $MNT $OPT $REMOTE_MEDIA_FILES $MEDIA_MNTPNT
    Why doesn't this work? It just gives me this as output:

    Code:
    root@client:~# mntserv
    Usage: mount -V                 : print version
           mount -h                 : print this help
           mount                    : list mounted filesystems
           mount -l                 : idem, including volume labels
    So far the informational part. Next the mounting.
    The command is `mount [-t fstype] something somewhere'.
    Details found in /etc/fstab may be omitted.
           mount -a [-t|-O] ...     : mount all stuff from /etc/fstab
           mount device             : mount device at the known place
           mount directory          : mount known device here
           mount -t type dev dir    : ordinary mount command
    Note that one does not really mount a device, one mounts
    a filesystem (of the given type) found on the device.
    One can also mount an already visible directory tree elsewhere:
           mount --bind olddir newdir
    or move a subtree:
           mount --move olddir newdir
    One can change the type of mount containing the directory dir:
           mount --make-shared dir
           mount --make-slave dir
           mount --make-private dir
           mount --make-unbindable dir
    One can change the type of all the mounts in a mount subtree
    containing the directory dir:
           mount --make-rshared dir
           mount --make-rslave dir
           mount --make-rprivate dir
           mount --make-runbindable dir
    A device can be given by name, say /dev/hda1 or /dev/cdrom,
    or by label, using  -L label  or by uuid, using  -U uuid .
    Other options: [-nfFrsvw] [-o options] [-p passwdfd].
    For many more details, say  man 8 mount .
    What boggles my mind is why this works:

    Code:
    #!/bin/sh
    BLAH='ls'
    OPT='-lh'
    DIR='/home/folder'
    
    $BLAH $OPT $DIR

  2. #2
    Linux Newbie
    Join Date
    Jul 2008
    Posts
    181
    You are seeing the "usage" of mount. This should tell you that you are using wrong options or arguments. My guess is that the blank in "Media Files" is causing a problem. Try quoting it.

  3. #3
    Linux User
    Join Date
    May 2008
    Location
    NYC, moved from KS & MO
    Posts
    251
    Another way to deal with the space in share name problem is to escape it, that is, change the line
    REMOTE_MEDIA_FILES='//server/Media Files'
    into
    REMOTE_MEDIA_FILES='//server/Media\ Files'

  4. #4
    Just Joined!
    Join Date
    Oct 2005
    Posts
    20
    I've tried that. It doesn't work. I've also tried \040, but no go either. That's what's so perplexing to me. Originally, I had the double quotes but changed them at some point. I'll try again tonight as I'm at work right now.

  5. #5
    Just Joined!
    Join Date
    Oct 2005
    Posts
    20
    Quote Originally Posted by burschik View Post
    You are seeing the "usage" of mount. This should tell you that you are using wrong options or arguments. My guess is that the blank in "Media Files" is causing a problem. Try quoting it.
    Oh wait.. You mean like this:

    '//server/"media files"'

  6. #6
    Linux Newbie
    Join Date
    Jul 2008
    Posts
    181
    Like this:

    Code:
    #!/bin/sh
    #
    # stupid mounting script
    #
    ##########################
    
    MNT='/sbin/mount'
    OPT='-t cifs -o username=myname,workgroup=workgroup,rw,uid=1000,gid=100'
    REMOTE_MEDIA_FILES='//server/Media Files'
    MEDIA_MNTPNT='/home/media'
    
    $MNT $OPT "$REMOTE_MEDIA_FILES" $MEDIA_MNTPNT

  7. #7
    Just Joined!
    Join Date
    Oct 2005
    Posts
    20
    Yes! That works! Thanks

Posting Permissions

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