LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
LinkBack Search this Thread
Old 10-09-2006, 04:17 AM   #1
crackerB
Member
 
Registered: Aug 2006
Posts: 37

Rep: Reputation: 15
Startup script not working in rc.local


I have added some startup scripts in rc.local to run at startup.
I am using Redhat El4 linux.
My scripts are not running at system startup.
After the server is up.I am executing it as a file.
Can anyone give some suggestions to this.
 
Old 10-09-2006, 04:19 AM   #2
slackie1000
Senior Member
 
Registered: Dec 2003
Location: Brasil
Distribution: Arch
Posts: 1,037

Rep: Reputation: 45
hi there,
could be a lot of things. rights? path?
it would be easier if you post how you are calling it in your rc.local and also the error messages.
regards,
slackie1000
 
Old 10-09-2006, 05:48 AM   #3
crackerB
Member
 
Registered: Aug 2006
Posts: 37

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by slackie1000
hi there,
could be a lot of things. rights? path?
it would be easier if you post how you are calling it in your rc.local and also the error messages.
regards,
slackie1000
THis is my script

[root@sd ~]# cat /etc/rc.local
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.

touch /var/lock/subsys/local
/sbin/iptables -F
/sbin/iptables -t nat -F
/sbin/iptables -t nat -A POSTROUTING -o eth1 -j MAQUERADE
/bin/echo "1">proc/sys/net/ipv4/ip_forward
[root@sd ~]#
 
Old 10-09-2006, 06:01 AM   #4
fotoguy
Senior Member
 
Registered: Mar 2003
Location: Brisbane Queensland Australia
Distribution: KirraMail Live Email Server
Posts: 1,275

Rep: Reputation: 61
Quote:
Originally Posted by crackerB
THis is my script

[root@sd ~]# cat /etc/rc.local
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.

touch /var/lock/subsys/local
/sbin/iptables -F
/sbin/iptables -t nat -F
/sbin/iptables -t nat -A POSTROUTING -o eth1 -j MAQUERADE
/bin/echo "1">proc/sys/net/ipv4/ip_forward
[root@sd ~]#

OK you have the rc.local file in the wrong location for starters, I think the location for Redhat is /etc/rc.d/init.d/rc.local, If the file is not in the right location and isn't executable, it wont run at bootup.
 
Old 10-09-2006, 06:25 AM   #5
crackerB
Member
 
Registered: Aug 2006
Posts: 37

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by fotoguy
OK you have the rc.local file in the wrong location for starters, I think the location for Redhat is /etc/rc.d/init.d/rc.local, If the file is not in the right location and isn't executable, it wont run at bootup.

I have done the thing which you told me...And still it is not working...any thing else to do..I have given chmod 777 to rc.local
also.!!!!
 
Old 10-09-2006, 06:35 AM   #6
slackie1000
Senior Member
 
Registered: Dec 2003
Location: Brasil
Distribution: Arch
Posts: 1,037

Rep: Reputation: 45
hi there,
weird. the file looks fine. as stated, you should check if the file location is correct.
considering that you can the script without problem from the command line,i am out of ideas.
somehow your boot sequence is not reading the file. why? sorry, don't know.
regards,
slackie1000
 
Old 10-09-2006, 06:42 AM   #7
fotoguy
Senior Member
 
Registered: Mar 2003
Location: Brisbane Queensland Australia
Distribution: KirraMail Live Email Server
Posts: 1,275

Rep: Reputation: 61
Sorry gave you the wrong location, try moving it to rc.d directory /etc/rc.d/rc.local and then change the permissions back to original:

Code:
chmod 0755 /etc/rc.d/rc.local
 
Old 10-09-2006, 07:14 AM   #8
//////
Member
 
Registered: Nov 2005
Location: Land of Linux :: Finland
Distribution: Quad boot :: Windows vista 64-bit | Vector Linux | Slackware 13.0 64-Bit | Debian 6.0 64-bit
Posts: 138

Rep: Reputation: 17
That looks like a typo.

Code:
/bin/echo "1">proc/sys/net/ipv4/ip_forward
I think it should be like this.

Code:
/bin/echo "1" > /proc/sys/net/ipv4/ip_forward
Cheers

////
 
Old 10-09-2006, 07:15 AM   #9
crackerB
Member
 
Registered: Aug 2006
Posts: 37

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by fotoguy
Sorry gave you the wrong location, try moving it to rc.d directory /etc/rc.d/rc.local and then change the permissions back to original:

Code:
chmod 0755 /etc/rc.d/rc.local

THANKS !!!!!!!!!!!!!!!!!!
 
Old 10-09-2006, 07:55 AM   #10
fotoguy
Senior Member
 
Registered: Mar 2003
Location: Brisbane Queensland Australia
Distribution: KirraMail Live Email Server
Posts: 1,275

Rep: Reputation: 61
Quote:
Originally Posted by crackerB
THANKS !!!!!!!!!!!!!!!!!!

Sounds like it's all working now, glad to help out
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
shell script to compare filese b/w local and remote and delete files from local serve dsids Linux - Networking 9 08-23-2006 07:20 AM
'cannot stat' script in /etc/rc.d/, try to run script at startup quintan Linux - Software 1 11-21-2005 02:53 AM
rc.local command halting startup DSLC Linux - General 4 06-04-2005 08:35 AM
rc.local yes/no option during startup jkassemi Linux - General 2 03-06-2005 10:54 AM
TOMCAT init script not working on startup -- tomcat 4.x / Mandrake Linux 8.0 jmartinph Mandriva 0 03-08-2004 01:31 AM


All times are GMT -5. The time now is 07:50 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration