|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Application developers can seamlessly integrate the Advantage Database install with their application install. Learn the best practices used when setting up silent installs with this seminar. |
|
#1
|
|||
|
|||
|
Hello,
I need to run ifconfig eth0:ip.ip.ip.ip when Linux server reboot. But How can I do this ? Thanks |
|
#2
|
|||
|
|||
|
'ifconfig' command not found or something? Can you be more specific?
|
|
#3
|
|||
|
|||
|
Hello,
No, I can found ifconfig, But it need to run automatically. (when linux reboot) Thanks |
|
#4
|
|||
|
|||
|
Which linux distribution, Redhat?
Have you configured your network interface thru Control Panel/Network Configurator? What NIC? Is it ISA or PCI? which module? Static IP or DHCP? |
|
#5
|
|||
|
|||
|
Ya,
I use RedHat Linux 6.0, and it can run ifconfig eth0:0 xx.xx.xx.xx under [@linux]#. But, each time when linux reboot, I must run ifconfig again. Therefore, I hope linux can run this command aotumatically. Thanks |
|
#6
|
|||
|
|||
|
Since you haven't provided me other info, I will use Dlink DFE530TX NIC as an example with Redhat 6.0:
1) create rc.modules file with the following 2 lines in it.. #!/bin/sh insmod /lib/modules/2.2.5-15/net/via-rhine.o (2) Place this rc.modules to /etc/rc.d/ (as /etc/rc.d/rc.modules) and chmod it to 755. 3) /etc/conf.modules: alias eth0 via-rhine ############################# note: dlink 530tx uses via-rhine.o. Check your /etc/conf.modules to find out which module your nic uses. Verify if it's found in /lib/modules/2.2.5-15/net, I don't remember the exact dir path for redhat 6.0 since I no longer run any linux for quite a while (been running freebsd since then), you need to find out if it's the correct path to your nic's driver. If your nic is ISA, not PCI, you should specify some opton in your /etc/conf.modules like.. options eth0 io=0xf880 irq=10 alias eth0 via-rhine |
|
#7
|
|||
|
|||
|
Does linux has batch file like autoexec.bat of DOS ?
for example, I need to run "ls" command on the text mode when linux reboot. Thanks |
|
#8
|
|||
|
|||
|
Yes. Like those rc* in your /etc directory.
As for the ls thing, do not run the ls itself. Write a script and put what you want there, then put the line to execute the script to /etc/rc.d/rc.local |
|
#9
|
|||
|
|||
|
Oh,
Would u please tell me a example for How to write a script? |
|
#10
|
|||
|
|||
|
## /etc/rc.d/rc.local file:
#!/bin/sh /usr/local/apache/bin/apachectl graceful ## /usr/local/apache/bin/apachectl is a script (written by my former co-worker URL) ## another script sample: #!/bin/sh ls -Al You can even write a perl script and place it in rc.local. ## /tmp/script: #!/usr/bin/perl open(NEWFILE,">>/tmp/newfile"); print NEWFILE "hello world"; close(NEWFILE); ## /etc/rc.d/rc.local file: #!/bin/sh perl /tmp/script Doing so will create a new file called "newfile" in /tmp directory with one line "hello world" in it after reboot. |
|
#11
|
|||
|
|||
|
Why would you need to do this in the first place? Are you changing the IP address on each reboot?
For a static IP you should be able to just create the file in /etc/sysconfig/network-scripts/ifcfg-ethX (where X is the card you're setting, 0 for the first one). If you set an address during installation or with linuxconf, the file should already be there and you can just edit it. Sorry if I misunderstood the issue. -Joe |
![]() |
| Viewing: Dev Shed Forums > Other > Beginner Programming > Run ifconfig command when reboot |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|