LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices



Reply
 
Search this Thread
Old 05-04-2007, 02:00 AM   #1
cyclonous_gt
LQ Newbie
 
Registered: Apr 2007
Posts: 4

Rep: Reputation: 0
Talking Linux Script


Hello guys,
Im just starting to learn linux systems and im having this project automatic restoration using linux rescue cd. I already customized my own copy of the rescue cd and already have tested to restore images using a SATA HDD. My problem now is how to program a script (rc) that will automatically detect between a SATA and an IDE HDD so that my mount parameters will fit the corressponding hdd interface?

Hope someone could help me on this. Thanks in advance.....
 
Old 05-12-2007, 12:18 PM   #2
hollywoodb
Member
 
Registered: Aug 2003
Location: Minnesota, U.S.A.
Distribution: Debian, openSUSE
Posts: 400

Rep: Reputation: 30
Just off the top of my head, depending on your kernel version and whether you're using a static /dev, IDE drives will be /dev/hd* and SATA drives will be /dev/sd*.

So you could use something like:

Code:
if [ -e /dev/hda ]; then
    do something
fi
if [ -e /dev/sda ]; then
    do something else
fi
Or however you want to do it. You could also check /sys/bus/ide/devices/ for devices, and there are probably a lot of other or better ways that I'm not aware of
 
  


Reply

Tags
linux, script


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
same awk script running on linux 7.2 and linux 10 suchi_s Programming 2 11-22-2004 08:47 AM
Converting a Windows Perl script to a Linux Perl script. rubbercash Programming 2 07-19-2004 11:22 AM
linux 9 and java script error - premature end of script header sibil Linux - Newbie 0 01-06-2004 05:21 PM
Exp. Windows/Linux-Script Programmer - Need Linux Programming Mentor! ruttiger Linux - Newbie 2 10-28-2001 12:00 PM


All times are GMT -5. The time now is 10:35 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration