LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   How to add a startup program in Linux?? (https://www.linuxquestions.org/questions/linux-general-1/how-to-add-a-startup-program-in-linux-520901/)

Cypher12 01-19-2007 10:34 AM

How to add a startup program in Linux??
 
Hello All,

I have a execuatble shell program that I need to run upon startup:

Code:

prompt$ cat program.sh
echo 1 > /proc/sys/net/ipv4/ip_forward
/prod/sbin/snmpd -c /prod/etc/snmpd.conf -s -l /dev/null -P /prod/var/run/snmpd -a
/sbin/route add -net 192.168.30.0 netmask 255.255.255.0 gw 192.168.2.3
/sbin/route add -net 192.168.110.0 netmask 255.255.255.0 gw 192.168.2.3
/sbin/route add -net 192.168.80.0 netmask 255.255.255.0 gw 192.168.2.3
/sbin/route add -net 192.168.100.0 netmask 255.255.255.0 gw 192.168.2.3

I tried adding the lines to the rc.local file in /etc .. but the script never runs. Can some tell me how I can get these lines to execute upon start up so my netork can be properly configured???

Also .. I am using Red Hat 9(for various reasons). I know that in Fedora Core 6, I could just simply add the program thru, preferences->more prefernces->session->starup programs. However on this particular machine, I have no gui, so I must figure out a way to maually add it(ie. thru the commmand line).

Thanks again and Take Care

kaz2100 01-19-2007 10:40 AM

Hi,

Does your init script have command to execute rc.local?

Happy Penguins!

Cypher12 01-19-2007 01:38 PM

Hello,

Thanks for relplying ... How would I find out if my init script has a command to run rc.local. How do I find this out and correct it if necessary??

Thanks again and Take Care

billymayday 01-19-2007 02:31 PM

Depending on what teh script is for, and how critical it's place in the startup process is, you can always add it to crontab using

@reboot /path/program.sh

I'm surprised that an entry in rc.local like

/path/program.sh

doesn't work. To check if rc.local is running, try adding something like

touch /home/your_username/test

Does program.sh run from the command line (ie is it executable)?

and see if it's there after a reboot.


All times are GMT -5. The time now is 06:27 PM.