Messages at login

Chris Bier chris.bier at cymor.com
Tue Jun 22 21:06:37 CDT 2004


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

|>-----Original Message-----
|>From: Chris Bier
|>
|>MOTD is Message of the day.  It displays a message that is
|>displayed on
|>login to give any info the admin wants to convey to all users without
|>sending an email to all.  AFAIK, /etc/motd is just a file and there is
|>no daemon.
|>
|>Fortune reads fortune files with quotes and displays a random entry.
|>It's just a program and has nothing to do with logins.  It
|>can, however
|>be added to .bash_profile, .profile, etc to display a random
|>quote for a
|>user's login.
|>
Brian Densmore wrote:
| So what you're saying is that it would be possible to
| write a daemon that could read a random spot in the
| fortune database at random intervals and stick it in
| /etc/motd? And no one has done this yet? Of
| course it would mean no one could personalize it as it
| would be system-wide. Thanks for removing my ignorance on
| the subject.
|
|

I wouldn't bother writing a daemon, I'd just make a cron job to remove
the old fortune entry from /etc/motd, call fortune, and add the output
to motd.
Something like:

0 0 0 * * sed -i '/---/,$d' /etc/motd; echo "---" >> /etc/motd; fortune
|> /etc/motd

This deletes everything from a line with just "---" in the /etc/motd
until the end, adds "---" back in, then appends the output of fortune to
/etc/motd at midnight every Sunday.

Chris
- --
I digitally sign my emails.  If you see an attachment with .asc, then
that means your email client doesn't support PGP digital signatures.
http://www.gnupg.org/(en)/documentation/faqs.html#q1.1
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFA2J9JE5xXU3JS1mQRAsnAAJwIg7HDzAIxzh2GEpnS/ceDd1IjqQCgnq4y
6hSqP+C2dvaTwNrUQopG4eM=
=gx6j
-----END PGP SIGNATURE-----




More information about the Kclug mailing list