Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Writing and init script to run a command at boot 2

Status
Not open for further replies.

Eddiefdz

IS-IT--Management
Mar 20, 2002
273
US
Hello,

I need to write an init script that will run the following commands for me:

echo "scsi add-single-device 0 0 0 0" > /proc/scsi/scsi
echo "scsi add-single-device 0 0 1 0" > /proc/scsi/scsi
echo "scsi add-single-device 0 0 2 0" > /proc/scsi/scsi
echo "scsi add-single-device 0 0 3 0" > /proc/scsi/scsi
echo "scsi add-single-device 0 0 4 0" > /proc/scsi/scsi
echo "scsi add-single-device 0 0 5 0" > /proc/scsi/scsi

Just in case you are wondering what this is, I have a firewire hardrive enclosure with 6 ide drives. The system finds the drive controller but in order to detect the actual drives I have to be typing those in manually into the command line every time i reboot. So what I want to do i have an init file that will run these commands for me at boot. I need to know what the initfile should look like and where exactly i should place it. I appreciate all the help.

Thanks,

Eddie Fernandez
CCNA, Network+, A+, MCP
 
[tt]
vi /etc/init.d/scandisk.sh
**********

#!/bin/bash
echo "scsi add-single-device 0 0 0 0" > /proc/scsi/scsi
echo "scsi add-single-device 0 0 1 0" > /proc/scsi/scsi
echo "scsi add-single-device 0 0 2 0" > /proc/scsi/scsi
echo "scsi add-single-device 0 0 3 0" > /proc/scsi/scsi
echo "scsi add-single-device 0 0 4 0" > /proc/scsi/scsi
echo "scsi add-single-device 0 0 5 0" > /proc/scsi/scsi
******************

chmod +x /etc/init.d/scandisk.sh
ln -s /etc/init.d/scandisk.sh /etc/rc3.d/S99scandisk

[/tt]
Hope this helps.

Cheers.
 
BTW take a look to the [tt]MAKEDEV[/tt] command.

man MAKEDEV

Cheers.
 
Worked like a charm.

Thanks, i appreciate the help.



Eddie Fernandez
CCNA, Network+, A+, MCP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top