If you would like to add a custom startup script to your Linux machine (for running ircd or an iptables script for example) the process is simple.
Create a file in /etc/init.d
chmod +x /etc/init.d/program
Edit it, and create something like this
case $1 in
sudo -u irc /home/ircd/unreal start
sudo -u irc /home/ircd/unreal stop
These scripts are run as root, so you should probably use sudo to run programs as unprivileged users.
Now we just have to add it to our default runlevel (runlevel can be found in /etc/inittab on Debian, in Ubuntu this file does not exist as far as I know). The runlevel should be the same across all Debian (including ubuntu) systems.
ln -s /etc/init.d/program /etc/rc2.d/S20program
The S20 requires a little bit of explanation. S means Start, and 20 means to run after the 19’s but before the 21+’s. It’s simply a priority system. You can replace S with K to ‘stop’ instead of ‘start’ when the computer shuts down.