How to add rc.local support to Debian 4.0 servers

April 19th, 2009 Categories: HOWTO's


Debian 4.0 doesn’t have an /etc/rc.local file, so if you’re used to adding your own startup scripts to /etc/rc.local then you will need to add this file manually as follows:

1
2
3
4
5
6
7
8
9
10
11
echo "#!/bin/bash" > /etc/init.d/rc.local
 
echo "# Add all the scripts to run after system startup" >> /etc/init.d/rc.local
 
echo "iptables-restore < /root/custom_firewall_rules" >> /etc/init.d/rc.local
 
chmod +x /etc/init.d/rc.local
 
ln -s /etc/init.d/rc.local /etc/rc.local
 
update-rc.d -f rc.local start 99 2 3 4 5 .

This will create an /etc/init.d/rc.local (needed for Debian to work properly) file, and add a rule to restore the custom iptables rule that I have saved in the /root/ folder.

Then we make the file executable, and lastly update the rc environment to detect & use rc.local as a startup file. On the last line I have some numbers: “99“, “2“, “3“, “4” & “5” – this tells the update script to run the script very last the start-up sequence (i.e. #99), and then activate it for run levels 2,3,4 & 5.

Tags: , , , ,
No comments yet.
You must be logged in to post a comment.