LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 03-10-2008, 03:53 PM   #1
Steve88XJ
LQ Newbie
 
Registered: Aug 2004
Location: Henderson, NV
Distribution: Ubuntu 7.10
Posts: 6

Rep: Reputation: 0
SMB Mount Script? Something like a batch file, how is it done?


Hello.

I'm FAIRLY new to linux, I have a bit of experience, but I'm mostly proficient in Windows.

I'm using ubuntu through VMware on a Windows XP based laptop that I take both to work and home.

At work, I have 4 Windows Shares that I want to mount, and at home I have a couple as well.

If I could make some sort of batch file like in Windows, I'd know how to get started on what I'm trying to accomplish, but basically, this is what I'm trying to accomplish.

1- script I can run to mount 2 mapped drives at home.
2- script I can run to umount 2 mapped drives at home.
3- script I can run to mount 4 mapped drives at work.
4- script I can run to umount 4 mapped drives at work.

I need these things to be independent, because if I'm connected with VPN (either way) I'd like to be able to mount all at once.

Lastly, and this I think will become very tricky, I'd like to make a script that I can run that will mount a windows share with an IP that changes all the time. The reason for this is that the version of VMWare I'm running doesn't support "shared files" and I'd like to access the files on the C drive of my host system. I can do this by mounting to it's IP address but it changes, and I can't seem to get my linux distro to recognize it by hostname (I suppose fixing that problem might be easier).

Any help?

heh, I fully expect after all that typing, I get NO replies...
 
Old 03-10-2008, 04:51 PM   #2
frenchn00b
Senior Member
 
Registered: Jun 2007
Location: E.U., Mountains :-)
Distribution: Debian, Etch, the greatest
Posts: 2,561

Rep: Reputation: 57
Quote:
Originally Posted by Steve88XJ View Post
Hello.

I'm FAIRLY new to linux, I have a bit of experience, but I'm mostly proficient in Windows.

I'm using ubuntu through VMware on a Windows XP based laptop that I take both to work and home.

At work, I have 4 Windows Shares that I want to mount, and at home I have a couple as well.

If I could make some sort of batch file like in Windows, I'd know how to get started on what I'm trying to accomplish, but basically, this is what I'm trying to accomplish.

1- script I can run to mount 2 mapped drives at home.
2- script I can run to umount 2 mapped drives at home.
3- script I can run to mount 4 mapped drives at work.
4- script I can run to umount 4 mapped drives at work.

I need these things to be independent, because if I'm connected with VPN (either way) I'd like to be able to mount all at once.

Lastly, and this I think will become very tricky, I'd like to make a script that I can run that will mount a windows share with an IP that changes all the time. The reason for this is that the version of VMWare I'm running doesn't support "shared files" and I'd like to access the files on the C drive of my host system. I can do this by mounting to it's IP address but it changes, and I can't seem to get my linux distro to recognize it by hostname (I suppose fixing that problem might be easier).

Any help?

heh, I fully expect after all that typing, I get NO replies...
The startup scripts are in /etc/rc2.d
and the /etc/fstab says all about mounting drive to location : all is possible there.

replies will follow my pre-reply.
 
Old 03-10-2008, 06:51 PM   #3
Steve88XJ
LQ Newbie
 
Registered: Aug 2004
Location: Henderson, NV
Distribution: Ubuntu 7.10
Posts: 6

Original Poster
Rep: Reputation: 0
I do have a couple of mount points in fstab now, but that's not what I'm after. The issue with that is, when I'm not connected to both networks, only the drives it can reach are mapped. I don't want it at bootup, I want to do it on the fly.

Also, since I've done the fstab thing, there seems to be an issue shutting down the OS cleanly, I have to tell VMWare to do a hard shut down after it tries. I'm not sure yet that it is an fstab issue yet, though.
 
Old 03-11-2008, 10:43 AM   #4
Steve88XJ
LQ Newbie
 
Registered: Aug 2004
Location: Henderson, NV
Distribution: Ubuntu 7.10
Posts: 6

Original Poster
Rep: Reputation: 0
Well, I found a solution.

I learned how to make shell scripts, but the only way to run them was to do a command with "bash [script name]", not something I could click on or stick in the menus.

If I put all my desired drive mappings in fstab, if they aren't all connected when I login, I can run "mount -a" and it will refresh the fstab list and look for those drives again.

"umount -a" removes everything mapped in fstab.

This will work for now, it's not ideal but it's decent.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
any shell script 2 batch file tools? rosbur Linux - General 12 11-27-2018 12:20 PM
Can someone help me to create a script that works like this batch file? Mysticle31 Programming 12 12-22-2007 06:10 PM
How to convert a batch file(.bat) to script file(.sh) manas_sem Programming 4 06-28-2007 12:10 PM
How do I write a script (batch file)?? cvzyl Linux - Software 4 07-30-2006 09:11 AM
Need help writing a batch/script file cbjhawks Linux - General 1 01-28-2004 05:54 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 06:06 AM.

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