Since I am familiar with Linux, I can tell how it can be done in linux.
First, write a shell script to launch matlab with the desired script. Something like this,
matlab -r "run('path/to/your/script.m');"
Then, there are multiple ways of launching a shell scripts on startup in linux, but the easiest would be to use a utility called 'cron' to do it. You can find more about how to install cron and set it up here