LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 09-25-2012, 11:44 PM   #1
linux_new_bie
LQ Newbie
 
Registered: Sep 2012
Posts: 9

Rep: Reputation: Disabled
Mounting SAN using shell script


Hi experts,
Greetings.
I am a newbie in linux and i have to write a shell script to include the mount command to mount the SAN.
I dont know how to run the command as super user.Can anyone please help me by providing the shell script to do so.
Actually the shell script should check whether SAN is mounted and if not mount the SAN

Sample;
mount /dev/sda1 /iscsi/vol01

This is the command .I dont know how to include it in shell script and put it in cron .So the shell script should not ask for superuser password at runtime.

Please help me by giving your valuable suggestions and ideas.

Thanks in advance.
 
Old 09-26-2012, 02:38 AM   #2
sackboy
LQ Newbie
 
Registered: Sep 2012
Posts: 20

Rep: Reputation: Disabled
Duplicate post?
http://www.linuxquestions.org/questi...an-4175429043/
 
Old 09-26-2012, 08:33 AM   #3
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 9,435
Blog Entries: 4

Rep: Reputation: 3378Reputation: 3378Reputation: 3378Reputation: 3378Reputation: 3378Reputation: 3378Reputation: 3378Reputation: 3378Reputation: 3378Reputation: 3378Reputation: 3378
Most of the time, I see these things listed in the mount-table for "automounting" to take care of at startup. Otherwise, I'd check the website documentation for that particular SAN, to see what they suggest as to "best practices" for their particular hardware. In other words, this isn't a script I'd plan to spend much time on, because I'd presume that there's probably an already-existing off the shelf way to do such a common and everyday thing. "Do not do a thing already done ..."
 
1 members found this post helpful.
Old 09-26-2012, 11:58 AM   #4
Rupadhya
Member
 
Registered: Sep 2012
Location: Hoffman Estates, IL
Distribution: Fedora 20
Posts: 167

Rep: Reputation: Disabled
I mounted another computer like this..

I did this to mount my old Windows XP machine to Linux. I run it as a cron job that executes every minute.

Code:
#! /bin/bash
## Mount the other machine
mountpoint="//192.168.1.1/C"
volume="/home/raj/c"
if mount | grep "on ${volume} type" > /dev/null
then
   echo "nothing" > /dev/null
else
   mount -w -t cifs $mountpoint $volume -o user={username}%{password},dir_mode=0777,file_mode=0766
fi
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Shell script to mount SAN linux_new_bie Linux - Newbie 14 09-26-2012 05:36 AM
How to pass command line arguments from one shell script to another shell script VijayaRaghavanLakshman Linux - Newbie 5 01-20-2012 10:12 PM
Executing a Shell script with 654 permissions inside another shell script. changusee2k Linux - Newbie 2 06-07-2011 08:58 PM
Mounting shared SAN space watersp Linux - General 1 02-10-2010 06:22 PM

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

All times are GMT -5. The time now is 06:07 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