Last active
August 29, 2015 14:27
-
-
Save jujhars13/6d4f679dccbc2f4ad97c to your computer and use it in GitHub Desktop.
dynamic message of the day script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| PROCCOUNT=`ps -Afl | wc -l` | |
| PROCCOUNT=`expr $PROCCOUNT - 5` | |
| GROUPZ=`groups` | |
| if [[ $GROUPZ == *irc* ]]; then | |
| ENDSESSION=`cat /etc/security/limits.conf | grep "@irc" | grep maxlogins | awk {'print $4'}` | |
| PRIVLAGED="IRC Account" | |
| else | |
| ENDSESSION="Unlimited" | |
| PRIVLAGED="Regular User" | |
| fi | |
| ip_address=`ifconfig eth1 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'` | |
| number_of_cpus=`cat /proc/cpuinfo | grep processor | wc -l` | |
| echo -e "\033[1;32m _ _ | |
| ______ _ _ | |
| | ___ \ | | | | | |
| | |_/ / _ _ | |_ ___ | |_ __ __ | |
| | ___ \| | | || __| / _ \ | __|\ \ / / | |
| | |_/ /| |_| || |_ | (_) | _ | |_ \ V / | |
| \____/ \__,_| \__| \___/ (_) \__| \_/ | |
| \033[0;35m+++++++++++++++++: \033[0;37mSystem Data\033[0;35m :+++++++++++++++++++ | |
| + \033[0;37mHostname \033[0;35m= \033[1;32m`hostname` | |
| \033[0;35m+ \033[0;37mAddress \033[0;35m= \033[1;32m${ip_address} | |
| \033[0;35m+ \033[0;37mKernel \033[0;35m= \033[1;32m`uname -r` | |
| \033[0;35m+ \033[0;37mUptime \033[0;35m= \033[1;32m`uptime | sed 's/.*up ([^,]*), .*/1/'` | |
| \033[0;35m+ \033[0;37mCPU \033[0;35m= \033[1;32m${number_of_cpus} | |
| \033[0;35m+ \033[0;37mMemory \033[0;35m= \033[1;32m`cat /proc/meminfo | grep MemTotal | awk {'print $2'}` kB | |
| \033[0;35m++++++++++++++++++: \033[0;37mUser Data\033[0;35m :++++++++++++++++++++ | |
| + \033[0;37mUsername \033[0;35m= \033[1;32m`whoami` | |
| \033[0;35m+ \033[0;37mPrivlages \033[0;35m= \033[1;32m$PRIVLAGED | |
| \033[0;35m+ \033[0;37mSessions \033[0;35m= \033[1;32m`who | grep $USER | wc -l` of $ENDSESSION MAX | |
| \033[0;35m+ \033[0;37mProcesses \033[0;35m= \033[1;32m$PROCCOUNT of `ulimit -u` MAX | |
| " |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
taken from http://parkersamp.com/2010/10/howto-creating-a-dynamic-motd-in-linux/