[comp.sys.next] .login file

hitt@Neon.Stanford.EDU (Daniel Hitt) (10/13/90)

I have a line in my .login file that reads:

if (`tty` == "/dev/console") then
	<application0> &
endif

I like to run <application0> when i log onto the console.
But the line doesn't work.

I know the syntax is correct, because when i put in the line

if (`tty` == "/dev/ttyp1") then
	<application0> &
endif

the application runs when i open a terminal window.

So . . .
(1) Is .login executed when one logs on at the console?

(2) What is the preferred way of having a script executed each time
one logs on at the console?

Thanks for any help anyone can provide.

dan
Newsgroups: comp.sys.next
Subject: .login
Summary: 
Expires: 
Sender: 
Followup-To: 
Distribution: 
Organization: Computer Science Department, Stanford University
Keywords: 

Newsgroups: comp.sys.next
Subject: .login file
Summary: When is .login executed?
Expires: 
Sender: hitt@neon.stanford.edu 
Followup-To: 
Distribution: 
Organization: Computer Science Department, Stanford University
Keywords: .login, NeXT, /dev/console, scripts

I have a line in my .login file that reads:

if (`tty` == "/dev/console") then
	<application0> &
endif

I like to run <application0> when i log onto the console.
But the line doesn't work.

I know the syntax is correct, because when i put in the line

if (`tty` == "/dev/ttyp1") then
	<application0> &
endif

the application runs when i open a terminal window.

So . . .
(1) Is .login executed when one logs on at the console?

(2) What is the preferred way of having a script executed each time
one logs on at the console?

Thanks for any help anyone can provide.

dan
Newsgroups: comp.sys.next
Subject: .login file
Summary: When is .login executed?
Expires: 
Sender: hitt@neon.stanford.edu 
Followup-To: 
Distribution: 
Organization: Computer Science Department, Stanford University
Keywords: .login, NeXT, /dev/console, scripts

I have a line in my .login file that reads:

if (`tty` == "/dev/console") then
	<application0> &
endif

I like to run <application0> when i log onto the console.
But the line doesn't work.

I know the syntax is correct, because when i put in the line

if (`tty` == "/dev/ttyp1") then
	<application0> &
endif

the application runs when i open a terminal window.

So . . .
(1) Is .login executed when one logs on at the console?

(2) What is the preferred way of having a script executed each time
one logs on at the console?

Thanks for any help anyone can provide.

dan
Newsgroups: comp.sys.next
Subject: .login
Summary: 
Expires: 
Sender: 
Followup-To: 
Distribution: 
Organization: Computer Science Department, Stanford University
Keywords: 

Newsgroups: comp.sys.next
Subject: .login file
Summary: When is .login executed?
Expires: 
Sender: hitt@neon.stanford.edu 
Followup-To: 
Distribution: 
Organization: Computer Science Department, Stanford University
Keywords: .login, NeXT, /dev/console, scripts

I have a line in my .login file that reads:

if (`tty` == "/dev/console") then
	<application0> &
endif

I like to run <application0> when i log onto the console.
But the line doesn't work.

I know the syntax is correct, because when i put in the line

if (`tty` == "/dev/ttyp1") then
	<application0> &
endif

the application runs when i open a terminal window.

So . . .
(1) Is .login executed when one logs on at the console?

(2) What is the preferred way of having a script executed each time
one logs on at the console?

Thanks for any help anyone can provide.

dan

brownfld@ux1.cso.uiuc.edu (10/13/90)

     When you login to console, .cshrc and .login are not executed.  They
are only executed when you enter csh, which only occurs when your pull up
a terminal or shell.  Thus, whenever you can pull up a value for `tty`
it will be the ttyp0 etc. for the shell, NOT the login.  The .cshrc and .login
like files for the Workspace are in .NeXT in your home directory.
     Couldn't you put this application in the dock?  You could choose whether
it would load or just keep the icon available on the dock.  If you just want
to tell if you are running on the console, you can do the following:

if	( ${?Workspace} )	then
	whatever_you_want
endif

     This will only run when you run a shell, but this is good for setting
your default editor to WriteNow if you're on the console and in a terminal
window.  If you have Terminal execute in your dock, you can have your
<application0> load automatically on boot-up with ${?Workspace}.

							Ken.
Kenneth R. Brownfield				   ken-b@uiuc.edu
University of Illinois, Urbana-Champaign
Junior, Computer Science/Engineering.

wiml@milton.u.washington.edu (William Lewis) (10/15/90)

   .cshrc and .login are only executed when you start a shell, for instance
by launching Terminal, Shell or Stuart. (Actually I don't know if 
.login is executed in these cases, maybe only .cshrc is). I think the
preferred way to have arbitrary things happen when you log in is
to use the defaults database:

dwrite loginwindow LoginHook /some/program/name
dwrite loginwindow LogoutHook /some/other/program

  "loginwindow" is the program that handles the login window (appropriately
enough); it's the NextStep equivalent of /bin/login. On the other
hand, I think these are global defaults (everyone who logs in on the
console has these programs run). The hook would have to do whatever
differentiation is neccessary.
-- 
 wiml@milton.acs.washington.edu       Seattle, Washington   
     (William Lewis)   |  47 41' 15" N   122 42' 58" W  
"These 2 cents will cost the net thousands upon thousands of 
dollars to send everywhere. Are you sure you want to do this?"

lane@SUMEX-AIM.STANFORD.EDU (Christopher Lane) (10/15/90)

In <9215@milton.u.washington.edu>, wiml@milton.u.washington.edu writes:
>
>... I think the preferred way to have arbitrary things happen when you
>log in is to use the defaults database:
>
>dwrite loginwindow LoginHook /some/program/name
>dwrite loginwindow LogoutHook /some/other/program
>
>... On the other hand, I think these are global defaults (everyone who
>logs in on the console has these programs run). The hook would have to
>do whatever differentiation is neccessary.

More specifically, root has to dwrite the LoginHook since loginwindow runs as
root.  Also, the program that is the LoginHook actually runs before the user
is logged in (intended as a login verification) so the user id will still be
root (though you can determine the user from the argument to the LoginHook).

I wouldn't recommend using the current LoginHook as a way of doing user
specific initialization.  Perhaps someone could design a 'dummy' Workspace
application that looked in the user database for something to execute on start
up and then started up the 'real' Workspace application.

- Christopher
-------