T.R | Title | User | Personal Name | Date | Lines |
---|
523.1 | you can write a program to do it | SMAUG::MENDEL | | Wed Jul 29 1987 14:01 | 11 |
| I don't know about doing it from DCL, but a small .exe can
1. Do a $GETUAI and return UAI$_LASTLOGIN_I (for interactive) and/or
UAI$_LASTLOGIN_N (non-interactive)
2. Do a $FAO to convert the quadword to a text string
3. Put the resultant string in a logical name or a symbol, for use
by LOGIN.COM, et al.
Kevin Mendel
|
523.2 | A DCL solution | MPGS::GUY | When reason fails, I use volume. | Wed Jul 29 1987 14:44 | 25 |
| In DCL you can do something like this:
$!program fragment to determine if I have logged on yet today
$
$ date=f$extract(0,11,f$time())
$ file=f$edit("[log_dir]"+date,"COLLAPSE")
$ if f$search(file) .nes. "" then goto FILE_MADE
$ Create 'file'
$ first_time = "YES"
$FILE_MADE:
$ Open/append lf 'file'.
$ write lf "Logged in at ",f$time()," ",f$mode()," on ",f$logical("sys$node")
$ close lf
$ if "''first_time'" .eqs. "" then exit
$!
$! put your daily stuff here
It produces a log file which looks like:
Logged in at 29-JUL-1987 13:35:49.66 INTERACTIVE on _SHR001::
I use it to invoke notes file extractors and some file maintenance stuff
once a day. It also gives me a security record.
Ed.
|
523.3 | "why you want it" may be important | PASTIS::MONAHAN | | Wed Jul 29 1987 23:18 | 20 |
| .1 will probably not give you what you want, since by the time
you get to LOGIN.COM your "last login" is the one just completed,
that is, a couple of seconds ago.
Something like .2, where LOGIN.COM itself stores the current
time somewhere for use the next time it runs will do fine if you
want it for utility or curiosity reasons. If you want it for security
reasons then this is not adequate, since it stores it where someone
who *has* gained access to your account can fake it.
Of course VMS keeps the sort of information you want in the
accounting log, and protects it from messing by non-privileged users.
An image installed with privileges could try to locate that
information. Alternatively a privileged image run from LOGIN.COM
could implement something like .2, keeping the information somewhere
only accessible with its privileges.
If it is some security reason that you want this for, then you
also have to protect the LOGIN.COM itself from modification or
replacement by the account.
|
523.4 | | SMAUG::MENDEL | | Thu Jul 30 1987 14:03 | 5 |
| My apologies.
.1 will not work, for the reason mentioned in .3. Live and learn.
Kevin Mendel
|
523.5 | File solution works fine | MAY20::MINOW | Je suis Marxist, tendance Groucho | Thu Jul 30 1987 15:22 | 11 |
| Thanks for the ideas, here's what I came up with:
$! Check if it's the first login of the day:
$! This will give benign error messages if TIMESTAMP.TEXT is missing.
$ last = f$file_attributes("SYS$LOGIN:TIMESTAMP.TEXT", "CDT")
$ today = f$cvtime("TODAY", "ABSOLUTE", "DATE")
$ last = f$extract(0, 11, last)
$ if last .eqs. today then goto same_day
$ copy nl: SYS$LOGIN:TIMESTAMP.TEXT;1 ! First login of the day
$ write sys$error "Have a nice day..."
$ same_day:
|
523.6 | Roll you own for now... | STAR::PIPER | Derrell Piper - VAX/VMS Development | Thu Jul 30 1987 15:32 | 4 |
| FYI: Being able to get this data (and others like it) from $GETJPI
(and F$GETJPI) is on the wishlist.
Derrell (LOGINOUT maintainer)
|
523.7 | oops | MAY20::MINOW | Je suis Marxist, tendance Groucho | Fri Jul 31 1987 11:37 | 11 |
| re: .5
Should be
$ copy/replace nl: SYS$LOGIN:TIMESTAMP.TEXT;1
Sorry.
Martin.
(graduate of the Evelyn Wood school of programming)
|
523.8 | | CURIE::DECARTERET | | Sun Aug 16 1987 00:49 | 2 |
| What is a noninteractive login?
-=*>Jason<*=-
|
523.9 | Batch & Other Things | CADSYS::SLATER | Ken Slater | Sun Aug 16 1987 00:53 | 7 |
| > What is a noninteractive login?
A login that is non-interactive! :-)
[A batch job, or a network job (copying files via a proxy), or a few
other obscure ones, but mostly those that don't connect SYS$COMMAND
to something recognizable as a terminal...Ken]
|
523.10 | Some one-plusses | DELNI::CANTOR | Dave C. | Tue Aug 25 1987 04:24 | 32 |
| Re .5
I suggest the following changes to the command procedure in
.5:
$! Check if it's the first login of the day:
$! This will give benign error messages if TIMESTAMP.TEXT is missing.
$ if f$search("SYS$LOGIN:TIMESTAMP.TEXT") .eqs. "" then -
copy nl: SYS$LOGIN:TIMESTAMP.TEXT/PROT=O:RW
$!$ last = f$file_attributes("SYS$LOGIN:TIMESTAMP.TEXT", "CDT")
$ last = f$file_attributes("SYS$LOGIN:TIMESTAMP.TEXT", "RDT")
$ today = f$cvtime("TODAY", "ABSOLUTE", "DATE")
$!$ last = f$extract(0, 11, last)
$ last = f$cvtime(last,"ABSOLUTE","DATE")
$ if last .eqs. today then goto same_day
$!$ copy nl: SYS$LOGIN:TIMESTAMP.TEXT;1 ! First login of the day
$ SET FILE /PROT=O:RW SYS$LOGIN:TIMESTAMP.TEXT;1
$ write sys$error "Have a nice day..."
$ same_day:
Advantages
1. Doesn't have to re-create new file each day, just modifies
old one and uses modification (revision) date instead of creation
date.
2. Doesn't rely on date being 11 characters long and doesn't
rely on f$file_att not omitting a leading zero before the tenth
of each month.
Dave C.
|
523.11 | | DISSRV::NORRIS | What is it, Miss Pfeffernuss? | Fri Sep 11 1987 10:55 | 60 |
| Re .10 As reply .7 said you need a /replace qualifier on the second
copy statement.
Which would cause the least overhead?
$ copy/replace nl: timestamp.text;1 or
$ copy/overlay nl: timestamp.text
Below the form feed is a routine I wrote to print the system notice
only when it changed. It's along the same lines as the other replies
but I'll put it in anyway.
$ Start_Of_Procedure_Chknotice: !*** See notes at end of procedure ***!
$
$ On Warning Then Goto Exit
$
$ login_file = ""
$ if f$trnlnm("display$notice") .eqs. "1" then $ goto type_notice
$
$ Print_notice:
$
$ Notice_Date = F$File_Attribut("sys$manager:notice.txt","Rdt")
$ Notice_Compare_Date = F$Cvtime(Notice_Date)
$
$ Login_File = F$Search("Sys$Login:Chknotice.Ejn")
$ If Login_File .Eqs. "" Then $ Goto Type_notice
$
$ Login_Date = F$File_Attribute(Login_File,"Cdt")
$ Login_Compare_Date = F$Cvtime(Login_Date)
$
$ If Login_Compare_Date .Ges. Notice_Compare_Date -
Then $ Goto Create_New_Time
$
$ Type_notice:
$
$ Ty sys$manager:notice.txt
$
$ Create_New_Time:
$
$ If Login_File .Nes. "" Then $ Delete Sys$Login:chknotice.Ejn.*
$ Create Sys$Login:chknotice.Ejn
$
$ Exit:
$
$ Exit 1
$
$ ! Set the logical DISPLAY$NOTICE to 1 to print the notice file
$ ! everytime the user logs in. Deassign it to shut off.
$ !
$ ! Examples:
$ !
$ ! $ DEFINE/SYSTEM DISPLAY$NOTICE "1"
$ ! all users see notices
$ !
$ ! $ DEASSIGN/SYSTEM DISPLAY$NOTICE
$ ! shuts off forced display of notice
|
523.12 | /OVERLAY is negligibly faster than /REPLACE for NL: | VIDEO::OSMAN | type video::user$7:[osman]eric.six | Fri Sep 11 1987 17:54 | 7 |
| COPY/OVERLAY is slightly faster than COPY/REPLACE for
$ copy/[overlay,replace] nl: foo.bar.488
running on our 8700. But it's negligible.
/Eric
|