Tuesday, September 2, 2008

update-motd in Ubuntu Intrepid

From the Ubuntu server team...

Every time you ssh or login to an Ubuntu system, you see some text that looks like this:
  Linux t61p 2.6.26-5-generic #1 SMP Fri Aug 15 13:54:22 UTC 2008 x86_64

 The programs included with the Ubuntu system are free software;
 the exact distribution terms for each program are described in the
 individual files in /usr/share/doc/*/copyright.

 Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
 applicable law.

 To access official Ubuntu documentation, please visit:
 http://help.ubuntu.com/

These are the contents of the file /etc/motd. "MOTD" stands for "Message of the Day". Hardly. Instead, this file is rather static, and somewhat bland. But there are some plans in the works by the Landscape team for making this more dynamic, and informative.

To do this, however, it would be useful to have a generic framework for automatically updating /etc/motd with the output of any given status-gathering script.

I have created a new package that provides this functionality, called update-motd, available in Ubuntu Universe for Intrepid:
  • sudo apt-get install update-motd
Once you've done so, create a script in /etc/update-motd.d.

Perhaps: /etc/update-motd.d/10-stats
  #!/bin/sh
 echo
 date
 echo
 who
 echo
 uptime

Make sure you chmod +x /etc/update-motd.d/10-stats

Then, you can either run /usr/bin/update-motd, or wait for the cronjob to automatically update /etc/motd.

And the next time you log in, it should look something like:
  Linux t61p 2.6.27-2-generic #1 SMP Thu Aug 28 17:18:43 UTC 2008 x86_64

 The programs included with the Ubuntu system are free software;
 the exact distribution terms for each program are described in the
 individual files in /usr/share/doc/*/copyright.

 Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
 applicable law.

 To access official Ubuntu documentation, please visit:
 http://help.ubuntu.com/

 Tue Sep  2 11:19:53 CDT 2008

 kirkland tty7         2008-09-01 10:58 (:0)
 kirkland pts/0        2008-09-01 22:00 (:0.0)
 kirkland pts/1        2008-09-02 07:53 (:0.0)
 kirkland pts/2        2008-09-02 09:29 (:0.0)
 kirkland pts/3        2008-09-02 09:41 (:0.0)

 11:19:53 up 1 day, 23 min,  5 users,  load average: 0.11, 0.11, 0.13

 kirkland@t61p:~$
For more information:
:-Dustin

No comments:

Post a Comment

Please do not use blog comments for support requests! Blog comments do not scale well to this effect.

Instead, please use Launchpad for Bugs and StackExchange for Questions.
* bugs.launchpad.net
* stackexchange.com

Thanks,
:-Dustin