ShellScrtips that run at Different System/User Level Events
Hi All,
I want to run certain ShellScrpts whenever: a user logs in, be it from Graphical Interface that is X, or from Virtual Console; a user logs out; a user restarts system; a user shuts down system. I am using Red Hat Enterprise Linux 5 and GNOME Desktop Environment. Wherein can I make such configurations? Thanks in advance! Dev. |
Look in /etc/rc.d/rc<run_level>.d/ and /etc/init.d/, paying close attention to /etc/rc.d/rc.local
Generally, scripts (usually in /etc/init.d) symlinked from /etc/rc.d/rc<run_level>.d with namse starting with K are executed when the system boots to that run level, and, if they start with an S, the script is called when therun level is exited. The rc.local script is run at the end of the boot process. For users, there is .bashrc to be executed when bash is started, and the Autorun directories in various .<Display_Manager> directories which are run when the user logs in to a specific display manager. |
Those will work for restart/shutdown.
For login you could look at /etc/profile. For logout I'm not sure; there's .bash_logout, but that's for each shell instance. You could look at this: http://linux.derkeiler.com/Mailing-L...-08/2313.html; a solution for KDE, might be an equiv for Gnome as well. |
I have already tired /etc/profile and it really serves the purpose of running a script when any user logs in.
It eliminates the time-consuming task of modifies each user's .bash_profile file. Well, now let's take: .bash_logout file. I can make use of it in a similar fashion but again I have to modify each user's .bash_logout file. Is there any way to do it on a "system-wide" level? Quote:
|
All times are GMT -5. The time now is 08:20 AM. |