autostart.sh is run on system startup. It can be used to run commands before XBMC/Kodi starts.
This script will hold up the boot process until it has completed, so if you want it run in the background the contents of your script should be encase like this
( some commands; some more commands ) &
You can also access the file via the configfiles samba share.
Depending on when you want your commands to run you need to put them in the proper location, or under the *) case if you want it run for any.
case "$1" in halt) # your commands here ;; poweroff) # your commands here ;; reboot) # your commands here ;; *) # your commands here ;; esac