LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 01-19-2007, 10:34 AM   #1
Cypher12
LQ Newbie
 
Registered: Sep 2006
Location: Toronto, Canada
Distribution: Gentoo, Fedora Core
Posts: 18

Rep: Reputation: 0
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
 
Old 01-19-2007, 10:40 AM   #2
kaz2100
Senior Member
 
Registered: Apr 2005
Location: Penguin land, with apple, no gates
Distribution: SlackWare > Debian testing woody(32) sarge etch lenny squeeze(+64) wheezy .. bullseye bookworm
Posts: 1,832

Rep: Reputation: 108Reputation: 108
Hi,

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

Happy Penguins!
 
Old 01-19-2007, 01:38 PM   #3
Cypher12
LQ Newbie
 
Registered: Sep 2006
Location: Toronto, Canada
Distribution: Gentoo, Fedora Core
Posts: 18

Original Poster
Rep: Reputation: 0
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

Last edited by Cypher12; 01-19-2007 at 01:53 PM.
 
Old 01-19-2007, 02:31 PM   #4
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
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.
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Mandriva startup scripts (need to add something to startup before X starts) thunderweasel Mandriva 3 01-01-2006 12:55 AM
Add Program to startup Shadow2982 Linux - Newbie 1 02-27-2005 05:48 PM
how can i add a program to startup with RH 9.0 akohamen Linux - Networking 1 01-16-2005 04:10 AM
Startup program in SUSE Linux rulirahm Linux - Newbie 8 10-12-2004 02:32 PM
How to add program to startup? lamiczka Linux - Newbie 2 02-17-2004 07:37 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:25 AM.

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