How to have Debian run a command when it starts

Pakman117

Senior member
Jan 20, 2001
303
2
81
I followed the IP Masquerading Howto found here and I'm at the point where it works great. However, in order for it to start running, I have to manually type in /etc/rc.d/rc.firewall-2.4 each time the system boots up. In order to avoid this, I just want 2.4 Debian to automatically run that command upon startup. How do I do this in verbose format please. Thank you for your time.
 

Barnaby W. Füi

Elite Member
Aug 14, 2001
12,343
0
0
Lots of ways to go about this, you could make an init script in /etc/init.d (is that what you have there?), and symlink it in /etc/rc2.d, or you could do a cron job with @reboot. Those are the two I can think of off the top of my head.
 

StuckMojo

Golden Member
Oct 28, 1999
1,069
1
76

i'm assuming you meant to say you type /etc/init.d/rc.firewall-2.4

update-rc.d rc.firewall-2.4 defaults

man update-rc.d for details
 

asb002

Member
Feb 17, 2003
122
0
0
Or for the easy way, you could put the command in /etc/init.d/local.start, or whatever it is in Debian. Probably /etc/init.d/rc.local.

EDIT: My bad, I meant init.d. Keep typing RedHat crap...
 

Nothinman

Elite Member
Sep 14, 2001
30,672
0
0
Debian doesn't have an /etc/rc.d directory, all the scripts are in /etc/init.d and the run levels are at /etc/rc#.d.

Since you already have the script in /etc/init.d you might as well just put it in rc2.d to startup last with the rest of the SysV init scripts with 'ln -s /etc/init.d/rc.firewall-2.4 /etc/rc2.d/S00rc.firewall-2.4.

This will start the firewall as soon as runlevel 2 is entered before anything else is started, if it's dependent on anything being started make sure that other thing is started in /etc/rcS.d or choose a S## number after it in rc2.d.