You've already forked ansible-role-common
Add file for role
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -9,8 +9,6 @@
|
|||||||
# Ignore roles
|
# Ignore roles
|
||||||
roles/*
|
roles/*
|
||||||
!roles/.gitkeep
|
!roles/.gitkeep
|
||||||
files/*
|
|
||||||
!files/.gitkeep
|
|
||||||
!files/authorized_keys/
|
!files/authorized_keys/
|
||||||
files/authorized_keys/*
|
files/authorized_keys/*
|
||||||
!files/authorized_keys/.gitkeep
|
!files/authorized_keys/.gitkeep
|
||||||
|
|||||||
75
files/dynmotd
Normal file
75
files/dynmotd
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Installation:
|
||||||
|
#
|
||||||
|
# 1. vim /etc/ssh/sshd_config
|
||||||
|
# PrintMotd no
|
||||||
|
#
|
||||||
|
# 2. vim /etc/pam.d/login
|
||||||
|
# # session optional pam_motd.so
|
||||||
|
#
|
||||||
|
# 3. vim /etc/profile
|
||||||
|
# /usr/local/bin/dynmotd # Place at the bottom
|
||||||
|
#
|
||||||
|
# 4. Then of course drop this file at
|
||||||
|
# /usr/local/bin/dynmotd
|
||||||
|
#
|
||||||
|
|
||||||
|
USER=`whoami`
|
||||||
|
HOSTNAME=`uname -n`
|
||||||
|
IP=`/sbin/ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'`
|
||||||
|
ROOT=`df -Ph | grep root | awk '{print $4}' | tr -d '\n'`
|
||||||
|
HOME=`df -Ph | grep home | awk '{print $4}' | tr -d '\n'`
|
||||||
|
BACKUP=`df -Ph | grep backup | awk '{print $4}' | tr -d '\n'`
|
||||||
|
|
||||||
|
MEMORY=`free -m | grep "Mem" | awk '{print $2,"-",$3,"-",$4}'`
|
||||||
|
SWAP=`free -m | grep "Swap" | awk '{print $2,"-",$3,"-",$4}'`
|
||||||
|
PSA=`ps -Afl | wc -l`
|
||||||
|
|
||||||
|
# time of day
|
||||||
|
HOUR=$(date +"%H")
|
||||||
|
if [ $HOUR -lt 12 -a $HOUR -ge 0 ]
|
||||||
|
then TIME="morning"
|
||||||
|
elif [ $HOUR -lt 17 -a $HOUR -ge 12 ]
|
||||||
|
then TIME="afternoon"
|
||||||
|
else
|
||||||
|
TIME="evening"
|
||||||
|
fi
|
||||||
|
|
||||||
|
#System uptime
|
||||||
|
uptime=`cat /proc/uptime | cut -f1 -d.`
|
||||||
|
upDays=$((uptime/60/60/24))
|
||||||
|
upHours=$((uptime/60/60%24))
|
||||||
|
upMins=$((uptime/60%60))
|
||||||
|
upSecs=$((uptime%60))
|
||||||
|
|
||||||
|
#System load
|
||||||
|
LOAD1=`cat /proc/loadavg | awk {'print $1'}`
|
||||||
|
LOAD5=`cat /proc/loadavg | awk {'print $2'}`
|
||||||
|
LOAD15=`cat /proc/loadavg | awk {'print $3'}`
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo -e "\e[7m--- GOOD $TIME $USER ----\e[0m"
|
||||||
|
echo ""
|
||||||
|
#MESSAGE=`/usr/bin/fortune | /usr/bin/cowsay`
|
||||||
|
#echo -e " $MESSAGE"
|
||||||
|
|
||||||
|
COLOR_COLUMN="\e[1m-"
|
||||||
|
COLOR_VALUE="\e[31m"
|
||||||
|
RESET_COLORS="\e[0m"
|
||||||
|
echo -e "
|
||||||
|
===========================================================================
|
||||||
|
$COLOR_COLUMN- Hostname$RESET_COLORS............: $COLOR_VALUE $HOSTNAME $RESET_COLORS
|
||||||
|
$COLOR_COLUMN- IP Address (ETH0)$RESET_COLORS..: $COLOR_VALUE $IP $RESET_COLORS
|
||||||
|
$COLOR_COLUMN- Release$RESET_COLORS.............: $COLOR_VALUE `cat /etc/redhat-release` $RESET_COLORS
|
||||||
|
$COLOR_COLUMN- Users$RESET_COLORS...............: $COLOR_VALUE Currently `users | wc -w` user(s) logged on $RESET_COLORS
|
||||||
|
=========================================================================== $RESET_COLORS
|
||||||
|
$COLOR_COLUMN- Current user$RESET_COLORS........: $COLOR_VALUE $USER $RESET_COLORS
|
||||||
|
$COLOR_COLUMN- CPU usage$RESET_COLORS...........: $COLOR_VALUE $LOAD1 - $LOAD5 - $LOAD15 (1-5-15 min) $RESET_COLORS
|
||||||
|
$COLOR_COLUMN- Memory used$RESET_COLORS.........: $COLOR_VALUE $MEMORY (total-free-used) $RESET_COLORS
|
||||||
|
$COLOR_COLUMN- Swap in use$RESET_COLORS.........: $COLOR_VALUE $SWAP (total-used-free) MB $RESET_COLORS
|
||||||
|
$COLOR_COLUMN- Processes$RESET_COLORS...........: $COLOR_VALUE $PSA running $RESET_COLORS
|
||||||
|
$COLOR_COLUMN- System uptime$RESET_COLORS.......: $COLOR_VALUE $upDays days $upHours hours $upMins minutes $upSecs seconds $RESET_COLORS
|
||||||
|
$COLOR_COLUMN- Disk space$RESET_COLORS..........: $COLOR_VALUE $ROOT remaining $RESET_COLORS
|
||||||
|
===========================================================================
|
||||||
|
"
|
||||||
Reference in New Issue
Block a user