LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-09-2009, 01:36 PM   #1
emmitt1219
LQ Newbie
 
Registered: Aug 2004
Posts: 12

Rep: Reputation: 0
Questions about rc.local


We are running on RHEL 5.2. We have created a custom shell script to be executed during the boot process. We have placed it in rc.local. One of the things that our script tries to do is to determine if a certain storage device has been detected and to try to partition this device. However, it seems that all fs related commands fail to execute in this script. Commands such as fdisk and mkfs do not appear to have executed at all. Does that mean that maybe this secondary drive has not been detected by the time rc.local is executed or these fs related commands are not available?

Thanks in advance.
 
Old 01-09-2009, 01:38 PM   #2
pbaldera
LQ Newbie
 
Registered: Nov 2005
Location: New York City
Distribution: RHEL3,4,5
Posts: 29

Rep: Reputation: 15
What kind of storage devices are refering to? SAN? if it is SAN are you using multipathing?
 
Old 01-09-2009, 01:40 PM   #3
emmitt1219
LQ Newbie
 
Registered: Aug 2004
Posts: 12

Original Poster
Rep: Reputation: 0
Actually, we are running on vmware. We are allocating a virtual drive viewed as a scsi dev to our image.
 
Old 01-09-2009, 01:55 PM   #4
pbaldera
LQ Newbie
 
Registered: Nov 2005
Location: New York City
Distribution: RHEL3,4,5
Posts: 29

Rep: Reputation: 15
In theory, fdisk, mkfs, etc should work from rc.local since it is the last thing to execute during the boot process. Make sure the new devices are to be activated at poweron.
 
Old 01-09-2009, 02:30 PM   #5
john test
Member
 
Registered: Jul 2008
Distribution: ubuntu 9.10
Posts: 527
Blog Entries: 1

Rep: Reputation: 35
Might try to insert commands into your script just for test to see if the path includes the commands you need ato the time of execution of your script and something to see if the device you are trying to work on shows up
you might insrt"
Code:
$ echo $PATH > testfile
$ lshw >> testfile
  or
$ hwinfo >> testfile
Then you could go back and see if the commands you need were covered in the path and that the device was available at the time you executed the script in rc.local

Last edited by john test; 01-09-2009 at 02:33 PM.
 
Old 01-09-2009, 04:44 PM   #6
emmitt1219
LQ Newbie
 
Registered: Aug 2004
Posts: 12

Original Poster
Rep: Reputation: 0
Checked the path. All the commands seem to be covered in the path...
 
Old 01-09-2009, 04:50 PM   #7
emmitt1219
LQ Newbie
 
Registered: Aug 2004
Posts: 12

Original Poster
Rep: Reputation: 0
And the device is available as well.
 
Old 01-09-2009, 06:34 PM   #8
john test
Member
 
Registered: Jul 2008
Distribution: ubuntu 9.10
Posts: 527
Blog Entries: 1

Rep: Reputation: 35
So rc.local shows a good path and an existing device
Do the commands function from the command line after boot?
 
Old 01-09-2009, 06:52 PM   #9
alan_ri
Senior Member
 
Registered: Dec 2007
Location: Croatia
Distribution: Debian GNU/Linux
Posts: 1,733
Blog Entries: 5

Rep: Reputation: 127Reputation: 127
Try
Code:
 if [ ! -f /etc/rc.d/rc.local ];then
before anything in your script,meaning,that should be the first line in the script.

Last edited by alan_ri; 01-09-2009 at 07:06 PM. Reason: to make things clearer
 
Old 01-09-2009, 06:55 PM   #10
emmitt1219
LQ Newbie
 
Registered: Aug 2004
Posts: 12

Original Poster
Rep: Reputation: 0
john_test:

yes and yes. The script works as expected when we execute it manually.
 
Old 01-09-2009, 07:42 PM   #11
patrickleigh9
LQ Newbie
 
Registered: Jan 2009
Posts: 1

Rep: Reputation: 0
Quote:
Originally Posted by alan_ri View Post
Try
Code:
 if [ ! -f /etc/rc.d/rc.local ];then
before anything in your script,meaning,that should be the first line in the script.
Confused, you want to check to see if rc.local exists before executing anything in their script even though rc.local is calling their script?

Last edited by patrickleigh9; 01-09-2009 at 07:53 PM.
 
Old 01-09-2009, 07:55 PM   #12
norobro
Member
 
Registered: Feb 2006
Distribution: Debian Sid
Posts: 548

Rep: Reputation: 197Reputation: 197
The fdisk man page on my Debian system states:
Quote:
There are several *fdisk programs around. Each has its problems and strengths. Try them in the order cfdisk, fdisk, sfdisk. (Indeed, cfdisk is a beautiful program that has strict requirements on the partition tables it accepts, and produces high quality partition tables. Use it if you can. fdisk is a buggy program that does fuzzy things - usually it happens to produce reasonable results. Its single advantage is that it has some support for BSD disk labels and other non-DOS partition tables. Avoid it if you can. sfdisk is for hackers only - the user inter‐face is terrible, but it is more correct than fdisk and more powerful than both fdisk and cfdisk. Moreover, it can be used noninteractively.)
Note the last sentence. From that I infer that fdisk will not work non-interactively. Clear as mud, right?
Maybe you should try sfdisk or "parted -s".

Last edited by norobro; 01-09-2009 at 08:15 PM. Reason: changed interactively to non-interactively
 
  


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
Setup local machine to allow lan machines to retrieve its local user mail. Brian1 Linux - Networking 3 03-30-2006 06:04 AM
Local webserver -- How to deny all client install their local web server--Please help b:z Linux - Networking 13 04-16-2005 08:11 PM
rc.local and cron questions wenberg Slackware 17 08-01-2004 12:18 AM
local box hostname administration questions VioLaToR Linux - Newbie 2 01-30-2004 06:07 AM
rc.local and cron background questions Greg21 Linux - Software 1 06-29-2003 12:46 PM


All times are GMT -5. The time now is 01:40 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration