You could try creating a small script who calls that function on boot or shutdown. Store it in your home-dir and make a sym-link from inside /etc/rc2d (boot) or /etc/rc0.d (shutdown) and perhaps /etc/rc6.d (reboot) Read man init and some info on bash scripting online (use Google to find them, I didn't bookmark what I've read
)