You should be able to put any script you write in /etc/init.d and have it loaded
on startup, and stopped on shutdown. You just need to use a case statement
to make it accept start, and stop. You can then set all your
startup commands to be executed when it recieves the start command. To add
commands for shutdown, have them under your stop command.
The reason this works is that /etc/rc.d/rc (on my Fedora system)
executes these scripts with a start or stop command, depending on
startup or shutdown. Most allow restart, reload, or other commands.
Here is an incomplete example, if you look at scripts in that file, you will
see that most adhere to certain standards, or are just function files.
Code:
#!/bin/bash
case $1 in
start)
STARTUP COMMAND1
STARTUP COMMAND2
STARTUP COMMAND3
;;
stop)
SHUTDOWN COMMAND1
SHUTDOWN COMMAND2
SHUTDOWN COMMAND3
;;
esac
You could also add your commands to an existing script that gets executed.
/etc/rc.d/rc.local is also common place to add startup commands