Today at work I decided to do make a few Debian scripts for generating a dynamic MOTD and auto-updating using apt-get and I thought I'd share.

Debian MOTD

The first script is a fun one and requires the fortune and cowsay packages. When run, it generates a cow saying a random message from the fortune quote program and writes it to /etc/motd. Cowsay isn't just limited to a cow, and a look through the documentation will reveal a whole range of ASCII art. Mine is set to run every night at midnight and it makes for some fun variety throughout the week. Here's an example of what a login looks like:

Welcome to Debian GNU/Linux 3.1!
_________________________________________
/ Q: What do Winnie the Pooh and John the \
| Baptist have in common? A: The same     |
\ middle name.                            /
-----------------------------------------
     \   ^__^
      \  (oo)\_______
         (__)\       )\/\
             ||----w |
             ||     ||

Linux jezebel 2.6.16-2006-03-28-mcw-01 #1
PREEMPT Tue Mar 28 21:32:57 PST 2006 x86_64 GNU/Linux

Debian Apt AutoUpdate

The second is for those who get tired of running the same apt-get update && apt-get upgrade command day after day just to keep their system up-to-date. The script is simple enough, using the -y argument to allow for unattended updates and writing verbose output to a log file.