LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   run script at logon (https://www.linuxquestions.org/questions/linux-general-1/run-script-at-logon-514490/)

sunlinux 12-28-2006 11:37 PM

run script at logon
 
How do i run my script at after every logon on REDHAT ES 4. :confused:

trickykid 12-29-2006 05:26 AM

Add it to your users .bash_login in their home directory.

archtoad6 12-29-2006 10:25 AM

Code:

ls /etc/rc.local
less /etc/rc.local

Sorry, I don't know where the man page is.

archtoad6 12-29-2006 10:34 AM

Also consider /etc/bashrc & /etc/profile, they are system-wide, i.e. apply to all users. I think /etc/bashrc is preferable, check man bash for the (slightly subtle) differences between them.


If instead you really want something that runs at every boot after the init scripts, check out /etc/rc.local:
Code:

ls /etc/rc.local
less /etc/rc.local

Sorry, I don't know where that man page is.

fotoguy 12-29-2006 11:01 PM

If you use the system wide configuration you can write some code to fire off a script, program or command based on either user id or group id.

Example:

Code:

if [ "$UID" = "1001" ]; then
    some command........
fi

if [ "$GID" = "100" ]; then
  . /execute/some/script
fi



All times are GMT -5. The time now is 10:20 PM.