Friday 26 August 2016

Tip - place for scripts

* A place for putting common scripts (with execution permission) that must be available for all the system is

/usr/local/bin
It can be called in any location.   



* Also,when trying to run commands or scripts on startup you can put the required command to run inside the file
~/.bashrc for a local command
or
/etc/bash.bashrc for a global command (for example a command that requires sudo). 

Both of the above commands will ask for the sudo passwork. If you do not put sudo, the script will not run if it requires administrative priviledges

You can also put a command that requires sudo inside your local .bashrc but you will be asked to put the sudo password everytime your start a command line or the .bashrc is processed (for example when running source ~/.bashrc)


* Also, to run an administrative command without having to put the admin password and that you want to be executed at the end of each multiuser runlevel, put your command in the file

/etc/rc.local
Also, take into account that you do not need to put sudo, the execution of this file has already administrative priviledges .
 
Do not forget to finish the command by providing an exit value. 0 means sucess and any other value means error.
Example:  
exit 0 
 
 
* For other related information, visit:
http://askubuntu.com/questions/228304/how-do-i-run-a-script-at-start-up

No comments:

Post a Comment