[comp.unix.admin] something like motd question

bshaw@hcmv2.ti.com (bob shaw) (05/10/91)

This is probably a very "basic" question .

What I am looking for is something like /etc/motd.

I would like to have a file that is read when a user logs in 
*IF* this file has been updated since it was last read by this
user.  This file would contain specific system  news info, etc and 
would constantly be changed by the sys_admin.

I know that /bin/login is first consulted when you login so something
like this is probably what I am looking for.

My particular system is a Sun SS1 or SS2. 

Any comments appreciated.

Thanks in advance.

Bob Shaw  Texas Instruments  Dallas
bshaw@hcvdl.vdl.ti.com

tchrist@convex.COM (Tom Christiansen) (05/11/91)

From the keyboard of bshaw@hcmv2.ti.com (bob shaw):
:This is probably a very "basic" question .
:
:What I am looking for is something like /etc/motd.
:
:I would like to have a file that is read when a user logs in 
:*IF* this file has been updated since it was last read by this
:user.  This file would contain specific system  news info, etc and 
:would constantly be changed by the sys_admin.

One approach is to put  'make -f .hushlogin' in users' .login
files, where this file contains the following:

    all: .hushlogin

    .hushlogin: /etc/motd
	    @$${PAGER-less} /etc/motd
	    @touch .hushlogin


--tom
--
Tom Christiansen		tchrist@convex.com	convex!tchrist
		"So much mail, so little time." 

darcy@druid.uucp (D'Arcy J.M. Cain) (05/11/91)

In article <bshaw.673889495@hcmv2> bshaw@hcmv2.ti.com (bob shaw) writes:
>I would like to have a file that is read when a user logs in 
>*IF* this file has been updated since it was last read by this
>user.  This file would contain specific system  news info, etc and 
>would constantly be changed by the sys_admin.

Sounds like you want news(1).  Check out the fine manual.

-- 
D'Arcy J.M. Cain (darcy@druid)     |
D'Arcy Cain Consulting             |   There's no government
Toronto, Ontario, Canada           |   like no government!
+1 416 424 2871                    |

wls@garden-brau.csd.uwm.edu (Bill Stapleton) (05/13/91)

In article <1991May10.235514.25515@druid.uucp>, darcy@druid.uucp (D'Arcy J.M. Cain) writes:
> In article <bshaw.673889495@hcmv2> bshaw@hcmv2.ti.com (bob shaw) writes:
> >I would like to have a file that is read when a user logs in  ...
 
> Sounds like you want news(1).  Check out the fine manual.

Or msgs(1) from BSD, available with fine BSD sources at an anonymous ftp site
near you (like ftp.uu.net)...

--
Bill Stapleton
     wls@csd4.csd.uwm.edu
     uwmcsd4!wls

andre@targon.UUCP (Andre van Dalen) (05/17/91)

In article <bshaw.673889495@hcmv2> bshaw@hcmv2.ti.com (bob shaw) writes:
 >I would like to have a file that is read when a user logs in
 >*IF* this file has been updated since it was last read by this
 >user.  This file would contain specific system  news info, etc and
 >would constantly be changed by the sys_admin.

You could add something like this to /etc/profile,
put your message in the file /etc/new_motd, . in the next lines
is the users home directory, which is where his shell starts.
(This example uses /bin/sh as login shell.)


if [ -n "`find /etc/new_motd -newer . -print`" ]
then
  cat /etc/new_motd
  touch .
fi

	hope this helps,
-- 
The mail|    AAA         DDDD  It's not the kill, but the thrill of the chase.
demon...|   AA AAvv   vvDD  DD        Ketchup is a vegetable.
hits!.@&|  AAAAAAAvv vvDD  DD                    {nixbur|nixtor}!adalen.via
--more--| AAA   AAAvvvDDDDDD    Andre van Dalen, uunet!hp4nl!targon!andre

fpb@ittc.wec.com (Frank P. Bresz) (05/17/91)

In article <1746@targon.UUCP> andre@targon.UUCP (Andre van Dalen) writes:

>In article <bshaw.673889495@hcmv2> bshaw@hcmv2.ti.com (bob shaw) writes:
> >I would like to have a file that is read when a user logs in
> >*IF* this file has been updated since it was last read by this
> >user.  This file would contain specific system  news info, etc and
> >would constantly be changed by the sys_admin.

>You could add something like this to /etc/profile,
>put your message in the file /etc/new_motd, . in the next lines
>is the users home directory, which is where his shell starts.
>(This example uses /bin/sh as login shell.)

>if [ -n "`find /etc/new_motd -newer . -print`" ]
>then
>  cat /etc/new_motd
>  touch .
>fi

[sig deleted]

Hi There,

	I am considering switching the bulk of the population from sh to
csh just so I can more easily customize (via /etc/profile) the way I want
user accounts to behave.  With over 400 users what are the chances that I
can put something into /etc/profile to correctly switch them to
.cshrc/.login after giving them information perhaps setting ENV variables
or whatever.  I know I can exec csh but I can't be certain what the right
thing to do is.  Any help appreciated.
--
| ()  ()  () | Frank P. Bresz   | Westinghouse Electric Corporation
|  \  /\  /  | fpb@ittc.wec.com | ITTC Simulators Department
|   \/  \/   | uunet!ittc!fpb   | Those who can, do. Those who can't, simulate.
| ---------- | +1 412 733 6749  | My opinions are mine, WEC don't want 'em.

fpb@ittc.wec.com (Frank P. Bresz) (05/17/91)

Of course my last post should have read from csh to sh, not what I typed
which was, from sh to csh.
--
| ()  ()  () | Frank P. Bresz   | Westinghouse Electric Corporation
|  \  /\  /  | fpb@ittc.wec.com | ITTC Simulators Department
|   \/  \/   | uunet!ittc!fpb   | Those who can, do. Those who can't, simulate.
| ---------- | +1 412 733 6749  | My opinions are mine, WEC don't want 'em.

jpm@logixwi.uucp (Jan-Piet Mens) (05/17/91)

andre@targon.UUCP (Andre van Dalen) writes:

>In article <bshaw.673889495@hcmv2> bshaw@hcmv2.ti.com (bob shaw) writes:
> >I would like to have a file that is read when a user logs in
> >*IF* this file has been updated since it was last read by this
> >user.  This file would contain specific system  news info, etc and
> >would constantly be changed by the sys_admin.

	Have you ever tried /usr/bin/news ?

-- 
Jan-Piet Mens, Logix GmbH				    jpm@logixwi.UUCP
Moritzstr. 50, D-6200 Wiesbaden            ...!uunet!mcsun!unido!logixwi!jpm

bill@unixland.uucp (Bill Heiser) (05/18/91)

>andre@targon.UUCP (Andre van Dalen) writes:
>
>	Have you ever tried /usr/bin/news ?

Is there some other more user-friendly version of news available
(other than the standard sysvr3 fare?)

news: index logins numbers

doesn't really mean much to the novice users among my users...



-- 
bill@unixland.uucp                 The Think_Tank BBS & Public Access Unix
    ...!uunet!think!unixland!bill
    ..!{uunet,bloom-beacon,esegue}!world!unixland!bill
508-655-3848 (2400)   508-651-8723 (9600-HST)   508-651-8733 (9600-PEP-V32)

darcy@druid.uucp (D'Arcy J.M. Cain) (05/18/91)

In article <1991May17.230644.15016@unixland.uucp> Bill Heiser writes:
>news: index logins numbers
>
>doesn't really mean much to the novice users among my users...

It isn't necessary for the users to know how to use news.  Simply create
your message files in the correct directory (/usr/news) and put this line
in /etc/profile:
    news
this will print all the files in /usr/news that this user hasn't seen yet.
You probably already have something like "news -n" in your /etc/profile
which will cause a list of unread news to be listed on the user's terminal
when they log in.  The can then type "news" if they wish to read them.  Read
the man page on news for details.  Here is a possible script to hold the
user's hand (off the top of my head):

  if [ ! "`news -s`" = "No news." ]
  then
    echo "The following news articles have not been read by you:"
    news -n
    echo "\nDo you want to read them now? [y]\c"
    read ans
    if [ "$ans" = "y" -o "$ans" = "Y" -o "$ans" = "" ]
    then
      clear
      news
    else
      echo "When ready to read news enter \"news\" at any prompt"
    fi
  fi

-- 
D'Arcy J.M. Cain (darcy@druid)     |
D'Arcy Cain Consulting             |   There's no government
Toronto, Ontario, Canada           |   like no government!
+1 416 424 2871                    |

bill@bilver.uucp (Bill Vermillion) (05/26/91)

In article <1991May17.230644.15016@unixland.uucp> bill@unixland.uucp (Bill Heiser) writes:

>>andre@targon.UUCP (Andre van Dalen) writes:
  
>>	Have you ever tried /usr/bin/news ?
 
>Is there some other more user-friendly version of news available
>(other than the standard sysvr3 fare?)
 
>news: index logins numbers
 

Why not   news | more    or   news | less   in their .profile.

This way it is always read, and they don't need to know a thing

-- 
Bill Vermillion - UUCP: ...!tarpit!bilver!bill
                      : bill@bilver.UUCP

bill@unixland.uucp (Bill Heiser) (05/30/91)

In article <1991May26.143729.9487@bilver.uucp> bill@bilver.uucp (Bill Vermillion) writes:
> 
>
>Why not   news | more    or   news | less   in their .profile.
>
>This way it is always read, and they don't need to know a thing
>

Does this work on your Esix system Bill?  On mine, when I type 'news',
I see all of the files, regardless of whether or not I've seen them
already.

Of course I can't subject my 1200/2400 baud users to 50 pages of
news (don't know exaclty how many, but there's lots) at every login :-)

-bill
-- 
bill@unixland.natick.ma.us	The Think_Tank BBS & Public Access Unix
    ...!uunet!think!unixland!bill       bill@unixland
    ..!{uunet,bloom-beacon,esegue}!world!unixland!bill
508-655-3848 (2400)   508-651-8723 (9600-HST)   508-651-8733 (9600-PEP-V32)

andyb@stb.info.com (Andy B.) (06/02/91)

bill@unixland.uucp (Bill Heiser) writes:
> Does this work on your Esix system Bill?  On mine, when I type 'news',
> I see all of the files, regardless of whether or not I've seen them
> already.

ISC's manual indicates something about a .news_time file
in the home directory that keeps the "currency time" as it's
modification date (so it implies).  Anything in the news
directory that is greater than this date will not be
read.  Unless you use the news -a option.  Hope that helps!

Andy
-- 
If it's not broken...your girlfriend will get bored with it anyway.