Steps as follows:
1. First of all, give your script-file executable permissions.
user@localhost:~$ chmod +x script-file.sh
|
2. Move your script-file to
/etc/init.d directory.
user@localhost:~$ sudo mv script-file.sh /etc/init.d
|
3. Update Init script links, by running following command
user@localhost:~$ sudo update-rc.d script-file.sh defaults
|
Remember, these steps would help you run a script on bootup, NOT AT LOGIN.
When you append, your commands in "
.bashrc" file. In this case, the commands will be executed when that particular user is logged in.
There is difference.
..............Done!!!