Messages at login

Gerald Combs gerald at zing.org
Tue Jun 22 22:05:09 CDT 2004


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.

You mean like this?

----------------
#!/bin/sh

MOTD_FILE=/tmp/motd

while [ 1 ] ; do
    SLEEP_TIME=`
        dd if=/dev/urandom bs=1 count=1 2> /dev/null |
        od  -d |
        head -1 |
        cut -f2- -d' '
        `
    cat > $MOTD_FILE << FIN
Welcome to `uname -n` running `uname -sr`

FIN

    fortune >> $MOTD_FILE

    sleep $SLEEP_TIME
done
----------------

If you're daring enough to actually use this then MOTD_FILE should be
changed to the proper location.  Seems easier to just run "fortune" from
/etc/profile or /etc/csh.cshrc, though.




More information about the Kclug mailing list