Listmates,
After finding some interesting information in the .bashrc tips at http://www.novell.com/coolsolutions/tools/17142.html,
I adapted the welcome screen idea to capture useful system information on login. I have to admit, the colors made it
pretty cool. (I'm easily amused tonight)
I pulled the useful information and created a separate welcome script that can be called as one of your last lines in
.bashrc. The .bashrc call is tested against the terminal type and skipped if a 'dump' terminal type is used such as in
the case of scp. It was a fun exercise that provided a bit of learning. For what it's worth, here is the call from .bashrc:
test "dumb" != $TERM && /home/david/linux/scripts/welcome
And, here is the welcome screen script:
#!/bin/bash
#
# Define the colors
#
black='\e[0;30m'
blue='\e[0;34m'
green='\e[0;32m'
cyan='\e[0;36m'
red='\e[0;31m'
purple='\e[0;35m'
brown='\e[0;33m'
lightgray='\e[0;37m'
darkgray='\e[1;30m'
lightblue='\e[1;34m'
lightgreen='\e[1;32m'
lightcyan='\e[1;36m'
lightred='\e[1;31m'
lightpurple='\e[1;35m'
yellow='\e[1;33m'
white='\e[1;37m'
nc='\e[0m'
#
# Get ifconfig information
#
netinfo ()
{
echo "-------------------------- Network Information --------------------------"
/sbin/ifconfig | awk /'inet addr/ {print $2}'
/sbin/ifconfig | awk /'Bcast/ {print $3}'
/sbin/ifconfig | awk /'inet addr/ {print $4}'
/sbin/ifconfig | awk /'HWaddr/ {print $4,$5}'
}
#
# Define a few functions
#
# Get the mounted drives and free space
#
mounted ()
{
echo "---------------------------- Mounted Drives -----------------------------"
df -h
}
#
# Check free memory
#
meminfo ()
{
echo "-------------------------- Memory Information ---------------------------"
free -tm
}
#
# Look at uptime
#
upinfo ()
{
echo "------------------------------- Uptime ----------------------------------"
echo ""
echo -ne "${lightblue}Uptime for:${green} $HOSTNAME ${lightblue}is ${cyan}";uptime | awk /'up/ {print
$3,$4,$5,$6,$7,$8,$9,$10}'
}
#
# Show the Welcome Screen
#
clear
echo -e "${red}+++++++++++++++++++++++++++++${white} W E L C O M E
${red}++++++++++++++++++++++++++++${nc}"; echo ""
echo -e "${lightblue}Host: \t\t\t ${cyan}$HOSTNAME"
echo -ne "${lightblue}Operating System: \t${cyan}" `cat /etc/SuSE-release`; echo
""
echo -e "${lightblue}Kernel Information: \t${cyan}" `uname -smr`
echo -ne "${lightblue}Hello ${lightred}$USER ${lightblue}today is: \t${cyan}" `date`; echo
""; echo ""
echo -e "${white}"; cal -3
echo -ne "${cyan}";netinfo; echo ""
echo -ne "${green}";mounted; echo ""
echo -ne "${red}";meminfo; echo ""
echo -ne "${cyan}";upinfo; echo ""
echo -e "${red}+++++++++++++++++++++++++${white} www.rankinlawfirm.com
${red}+++++++++++++++++++++++++${nc}\n"
The screen output will look like this:
+++++++++++++++++++++++++++++ W E L C O M E ++++++++++++++++++++++++++++
Host: rankin-p35a
Operating System: openSUSE 10.3 (i586) VERSION = 10.3
Kernel Information: Linux 2.6.22.13-0.3-default i686
Hello david today is: Sun Jan 20 00:14:52 CST 2008
December 2007 January 2008 February 2008
Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
1 1 2 3 4 5 1 2
2 3 4 5 6 7 8 6 7 8 9 10 11 12 3 4 5 6 7 8 9
9 10 11 12 13 14 15 13 14 15 16 17 18 19 10 11 12 13 14 15 16
16 17 18 19 20 21 22 20 21 22 23 24 25 26 17 18 19 20 21 22 23
23 24 25 26 27 28 29 27 28 29 30 31 24 25 26 27 28 29
30 31
-------------------------- Network Information --------------------------
addr:192.168.6.101
addr:127.0.0.1
Bcast:192.168.6.255
Mask:255.255.255.0
HWaddr 00:11:F5:15:2D:83
HWaddr 00:02:3F:DC:E3:3C
HWaddr 00-11-F5-15-2D-83-00-00-00-00-00-00-00-00-00-00
---------------------------- Mounted Drives -----------------------------
Filesystem Size Used Avail Use% Mounted on
/dev/sda6 15G 7.5G 6.6G 54% /
udev 506M 88K 506M 1% /dev
/dev/sda7 51G 2.9G 45G 6% /home
/dev/sda1 43G 23G 20G 54% /windows/C
//nemesis/samba 233G 31G 203G 14% /mnt/nemesis
//nemesis/david 233G 31G 203G 14% /mnt/nemesis-david
//nemesis/config 233G 31G 203G 14% /mnt/nemesis-cfg
//kidsdell/config 17G 5.6G 9.8G 37% /mnt/kids-cfg
-------------------------- Memory Information ---------------------------
total used free shared buffers cached
Mem: 1011 992 18 0 104 426
-/+ buffers/cache: 461 549
Swap: 2055 0 2055
Total: 3066 992 2073
------------------------------- Uptime ----------------------------------
Uptime for: rankin-p35a is 13:57, 4 users, load average: 0.08, 0.11, 0.14
+++++++++++++++++++++++++ www.rankinlawfirm.com +++++++++++++++++++++++++
I'm sure there are better ways to do all of this, but it filled the idle time watching the kids. Also, with the number
of different boxes I look at, the quick reference to memory and disk information provided a good quick check on a few
stats at login. Have fun!
--
David C. Rankin, J.D., P.E.
Rankin Law Firm, PLLC
510 Ochiltree Street
Nacogdoches, Texas 75961
Telephone: (936) 715-9333
Facsimile: (936) 715-9339
www.rankinlawfirm.com
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]