LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-14-2003, 03:43 PM   #1
amphion
LQ Newbie
 
Registered: Mar 2003
Posts: 25

Rep: Reputation: 15
startup scripts


Where do I put scripts so that they run at boot?
 
Old 03-14-2003, 03:49 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
depends what they are really. some more information would be useful....

if it's just a nondescript script then you can added it to the end of /etc/rc.local.
 
Old 03-14-2003, 03:51 PM   #3
bulliver
Senior Member
 
Registered: Nov 2002
Location: Edmonton AB, Canada
Distribution: Gentoo x86_64; Gentoo PPC; FreeBSD; OS X 10.9.4
Posts: 3,760
Blog Entries: 4

Rep: Reputation: 78
You can put small ones in /etc/rc.local

If your script is a seperate file you an put it anywhere and just have a reference to it in rc.local ie:

Code:
# in rc.local
/path/to/script
 
Old 03-14-2003, 03:53 PM   #4
amphion
LQ Newbie
 
Registered: Mar 2003
Posts: 25

Original Poster
Rep: Reputation: 15
I want to run iptables and nat so I want to run this script:

iptables --flush - Flush all the rules in filter and nat tables
iptables --table nat --flush
iptables --delete-chain - Delete all chains that are not in default filter and nat table
iptables --table nat --delete-chain

# Set up IP FORWARDing and Masquerading
iptables --table nat --append POSTROUTING --out-interface ppp0 -j MASQUERADE
iptables --append FORWARD --in-interface eth0 -j ACCEPT - Assuming one NIC to local LAN

echo 1 > /proc/sys/net/ipv4/ip_forward - Enables packet forwarding by kernel
 
Old 03-14-2003, 03:57 PM   #5
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
yeah i'd just stick that in rc.local, but if you wanted to create a full blown service file for it you should be able to.
 
Old 03-14-2003, 04:01 PM   #6
amphion
LQ Newbie
 
Registered: Mar 2003
Posts: 25

Original Poster
Rep: Reputation: 15
Quote:
but if you wanted to create a full blown service file for it you should be able to
What do you mean with that.

Thanks for the quick replies btw
 
Old 03-14-2003, 04:17 PM   #7
bulliver
Senior Member
 
Registered: Nov 2002
Location: Edmonton AB, Canada
Distribution: Gentoo x86_64; Gentoo PPC; FreeBSD; OS X 10.9.4
Posts: 3,760
Blog Entries: 4

Rep: Reputation: 78
Depending on your distro, there are files to stop and start most of your services. They are usually in /etc/rc.d but may be elsewhere. They are tough for a beginner so depending on your experience you will probably just want to stick with rc.local

For a firewall what I did was put the commands in a file called /etc/rc.d/firewall , then simply add "/etc/rc.d/firewall" to rc.local. Make sure that it is executable and has "#!/bin/bash" as the first line.
 
Old 03-14-2003, 04:33 PM   #8
amphion
LQ Newbie
 
Registered: Mar 2003
Posts: 25

Original Poster
Rep: Reputation: 15
I have iptables running as a service/deamon. I'm running redhat 8.

I can put the above scripts in an iptables config file too? If so, where is this config file?
 
Old 03-28-2003, 02:39 PM   #9
juggler
LQ Newbie
 
Registered: Oct 2002
Posts: 8

Rep: Reputation: 0
iptables config

The iptables config is located at:
/etc/sysconfig/iptables

Your best best is to set up your firewall using the script, then
running:
iptables-save

This rewrites your firewall setup to /etc/sysconfig/iptables.
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Startup Scripts?? jimbo-62 Debian 5 07-10-2005 11:23 AM
startup scripts... ValidiusMaximus Linux - Software 8 01-11-2005 06:55 PM
Startup Scripts jhartney Linux - Newbie 3 01-07-2005 02:35 AM
startup scripts mimi Linux - General 1 04-24-2002 04:22 AM
X Startup Scripts JHuizingh Linux - General 1 09-18-2001 02:02 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:15 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration