Q:  How do you execute ~/.login, ~/.cshrc, ~/.profile, or ~/.logout without invoking Terminal, Shell, or a similar sort of shell-based terminal emulator?  Is there a hook in Workspace Manager that allows you do something when you log in or log out?

A:  All the shell run control files (the ones mentioned above) are shell-specific.  .cshrc, .login, and .logout pertain to the C-Shell; .profile pertains to the Bourne Shell.  Only those programs examine and execute these files.  (By implication, then, if your login shell is neither csh nor sh, these files are not executed even when you launch Terminal or Shell.)

There is a "LoginHook" and a "LogoutHook" in loginwindow.  The LoginHook is run just before loginwindow launches the specified workspace (by default, the NeXT Workspace Manager; but this can be overridden in the user's defaults database), and after account verification.  Note that the LoginHook is NOT run under the Workspace Manager, but rather is run BEFORE the Workspace Manager.  LogoutHook is run after the Workspace Manager terminates.

To set up these hooks, type:

	myhost% su
	myhost# dwrite loginwindow LoginHook someProgram
	myhost# dwrite loginwindow LogoutHook someOtherProgram
	myhost# exit

where the final argument to dwrite is the name of whatever program you want to run.  This creates the default on a machine-by-machine basis, since the information is stored in the directory /.NeXT.  (Of course, if you have netboot clients, it need only be done on the servers of all the clients, since the root directory is shared.)
 
Note that neither hook is run if an automatic "me" login is performed.  The real philosophy behind the hooks is to provide additional accounting or authentication, rather than setting up the Workspace Manager's environment.  If something is required within the Workspace Manager's environment, the only real option is to have a program of your specification autolaunched from your dock.

See /NextLibrary/Documentation/NextAdmin/11_StartupShutdown/_ObservingTheBootProcess.rtf for more information on loginwindow.

QA500

Valid for 1.0, 2.0, 3.0