This is how you should do it.
su [Enter your root password]
Inside of savevolumestate.sh place this.
#LindyLex example to save the audio state.
echo "Saving Audio State."
chmod a+x /etc/init.d/savevolumestate.sh
Now we tell it to execute when the computer is shutdown or rebooted. Yes that is a period at the end of the command don't forget it.
update-rc.d savevolumestate.sh start 20 0 6 .
These are the meaning behind the numbers.
- 0 = halt
- 1 = single user
- 2 = CLI, multi-user, no net
- 3 = CLI, multi-user, networked
- 4 = open
- 5 = GUI, multi-user, networked
- 6 = reboot
The "20" you could use this for your script. You can learn more about the meaning of the number after you read about update-rc.d below.
You can learn more by reading the following, execute this in the terminal.
That is it.