LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
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 10-19-2003, 10:30 PM   #1
ewto
Member
 
Registered: Jan 2003
Location: Ohio, USA
Distribution: RH 9.0 / Fedora Core 3
Posts: 58

Rep: Reputation: 15
bash script to detect scsi address at boot


I have a multi card reader and a cd burner. When the system boots sometimes the cd burner is scsi0 and the card reader is scsi1 ... sometimes it is the other way around.

I have to do a cdrecord -scanbus after boot to see which device is on which address and then I have to

Code:
echo "scsi add-single-device 0 0 0 1" > /cat/proc/scsi/scsi
etc to enable the luns for the last three slots on the card reader.

I would like to create a script that does this automatically at boot time once the burner and card reader are assigned addresses. I considered just writing the script to issue the command both ways, one way throwing the error and the other working... but this does not seem to be "good programming"

Is there a less klunky way to accomplish this?

thanks
ewto
 
Old 10-20-2003, 12:26 AM   #2
megaspaz
Senior Member
 
Registered: Nov 2002
Location: Silly Con Valley
Distribution: Red Hat 7.3, Red Hat 9.0
Posts: 2,054

Rep: Reputation: 46
i'm not sure this is gonna be less kludgey, but i kinda do the same thing for my laptop because my scsi-emulated dvd device can have dma enabled while my scsi-emulated zip drive can not and they both are modular bays sharing hdc. but i just write a script using hdparm -I /dev/hdc | grep "TOSHIBA" > /tmp/temp.txt and check that file to see if that file is 0 B in file size meaning the zip drive is in and to not try to enable dma. maybe you can do something similar with the cdrecord command you're using. send the output to a text file and analyze the text file through grep or something like that and start the script at boot up. i dunno.... just a thought....
 
Old 10-20-2003, 02:47 AM   #3
ewto
Member
 
Registered: Jan 2003
Location: Ohio, USA
Distribution: RH 9.0 / Fedora Core 3
Posts: 58

Original Poster
Rep: Reputation: 15
thanks for your time.
I'll tinker with something like that and see what I can come up with... that's a very original way of addressing the problem. I like the way you think!

I'm open to anything.

ewto

Last edited by ewto; 10-20-2003 at 04:44 AM.
 
  


Reply



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
Obtain ip address and check for running process via Bash Script? xconspirisist Programming 10 09-12-2008 01:18 PM
Bash Script to Detect USB drive mount status nutthick Programming 6 02-02-2005 08:17 AM
Hotplug SCSI scanner or How to write to /proc/scsi/scsi from within a shell script. samac Linux - Hardware 1 08-30-2004 02:28 PM
How can I get the computer to boot up and run a program/game w/ bash script or C++? DaMan101 Linux From Scratch 1 04-10-2004 12:23 AM
Bash Script: Getting IP address fr0st Programming 3 01-14-2004 06:22 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:59 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
Open Source Consulting | Domain Registration