Tips and Tricks For Hardworking Admins - Page 2

 By Carla Schroder
Page 2 of 2   |  Back to Page 1
Print Article

Another way to deliver new MOTDs is to use the fortune program. Fortune has been around forever, and a bit of searching will find all sorts of different fortune databases, like BOFH excuses, fortune cookies, Top 100 things you don't want the sysadmin to say, Quotes from Murphy's laws, riddles, offensive fortunes, and literary quotations. Here is an example Debian installation and setup:

# apt-get install fortunes fortune-mod fortunes-bofh-excuses

Then start having fun. To see a list of all your installed fortune databases:

# /usr/games/fortune -f
100.00% /usr/share/games/fortunes
3.01% art
1.32% law
0.07% ascii-art
1.30% food
0.98% kids
0.98% love
2.19% linux
6.74% computers
1.49% startrek
2.75% wisdom
2.97% bofh-excuses

Let's try a couple of these:

$ /usr/games/fortune linux
Let's call it an accidental feature.
--Larry Wall

$ /usr/games/fortune startrek
"Can you imagine how life could be improved if we could do away with jealousy, greed, hate ..."

"It can also be improved by eliminating love, tenderness, sentiment -- the other side of the coin"
-- Dr. Roger Corby and Kirk, "What are Little Girls Made Of?", stardate 2712.4

To see a new, randomly-selected fortune every time you login or open a new shell, simply make an entry in ~/.bashrc, or in /etc/bash.bashrc to run it system wide, like this:

#run a new fortune randomly

You can easily create a custom fortune database. Create a plain text file with each fortune separated by a percent sign, like this homegrown admin-policies file:

Remember, today is the annual change-your-login password day! Make it eight to twelve characters long. Do not use dictionary words, names of animals or people, company or product name. Use a mix of letters, numbers, and punctuation marks. Write it down and keep it in a safe place! You know, like hidden!
-- Thank you, your faithful sysadmin deity

Today is Sysadmin Appreciation Day. Please deliver offerings of cookies, cake, and good strong coffee to my office.
-- Thank you, your faithful sysadmin deity

Remember to shut your workstations down at the end of the day! Don't be a watt-waster!
-- Thank you, your faithful sysadmin deity

Store this file in /usr/share/games/fortunes, and make it world-readable. Fortune does not read the file, but its associated .dat file. Create it with the strfile command:

# strfile admin-policies admin-policies.dat
"admin-policies.dat" created
There were 201 strings
Longest string: 1690 bytes
Shortest string: 43 bytes

To display fortunes from this file, simply run /usr/games/fortune admin-policies.

You may edit any existing fortune database, just remember to run the strfile command every time you make a change.

Come back next week for more excellent Tips and Tricks For Hardworking Admins.


This article was originally published on Sep 28, 2005
Get the Latest Scoop with Networking Update Newsletter