LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Run bash script automatically after the root log in (https://www.linuxquestions.org/questions/linux-newbie-8/run-bash-script-automatically-after-the-root-log-in-4175499963/)

Noazet 03-30-2014 01:39 PM

Run bash script automatically after the root log in
 
Guys I am new to Linux ... I am using redhat ... I did a script which check if the one logging in is the root or jog but the problem is every time I want the bash script to run I should make right click and open terminal and type sh script.sh so if I want the script to run automatic after logging in what steps/commands should I write ???

mrclisdue 03-30-2014 06:23 PM

Put the script in root's .bash_profile ... or .bashrc .

This is the first result of "when is bashrc called" in my search-foo, and it's a nice little explanation of the two, so rather than me reinventing the wheel, give it a read:

http://www.joshstaiger.org/archives/...rofile_vs.html

cheers,


All times are GMT -5. The time now is 11:32 AM.