bunch of improvements
This commit is contained in:
parent
fc178aeb05
commit
55da16f246
@ -26,7 +26,7 @@ sudo ./install.sh
|
||||
|
||||
It is compatible with [update-motd](https://launchpad.net/update-motd) used by Ubuntu.
|
||||
|
||||
For all other distributions you will have to add the following line to `/etc/pam.d/sshd`:
|
||||
For not compatible distributions you will have to add the following line to `/etc/pam.d/sshd`:
|
||||
|
||||
```
|
||||
session optional pam_exec.so stdout /etc/update-motd.d/00-basic
|
||||
|
@ -4,7 +4,7 @@ truncate -s0 /etc/motd # empty native static motd
|
||||
mkdir -p /etc/update-motd.d/ # create dedicated directory following ubuntu
|
||||
cp motd /etc/update-motd.d/ # copy the static motd banner into it
|
||||
chmod -x /etc/update-motd.d/* # disable any existing script
|
||||
cp scripts/* /etc/update-motd.d/ # enable claranet motd
|
||||
cp scripts/* /etc/update-motd.d/ # enable claranet motd script
|
||||
|
||||
echo "For distributions which does not use update-motd (e.g. ubuntu/debian), do not forget to add the following to /etc/pam.d/sshd:"
|
||||
echo "session optional pam_exec.so stdout /etc/update-motd.d/00-basic"
|
||||
|
@ -4,24 +4,24 @@
|
||||
cat $(dirname $0)/motd
|
||||
|
||||
# get load averages
|
||||
IFS=" " read LOAD1 LOAD5 LOAD15 <<<$(cat /proc/loadavg | awk '{ print $1,$2,$3 }')
|
||||
IFS=" " read LOAD1 LOAD5 LOAD15 <<<$(awk '{ print $1,$2,$3 }' /proc/loadavg)
|
||||
# get free memory
|
||||
IFS=" " read USED AVAIL TOTAL <<<$(free -htm | grep "Mem" | awk {'print $3,$7,$2'})
|
||||
# get processes
|
||||
PROCESS=`ps -eo user=|sort|uniq -c | awk '{ print $2 " " $1 }'`
|
||||
PROCESS_ALL=`echo "$PROCESS"| awk {'print $2'} | awk '{ SUM += $1} END { print SUM }'`
|
||||
PROCESS_ROOT=`echo "$PROCESS"| grep root | awk {'print $2'}`
|
||||
PROCESS_USER=`echo "$PROCESS"| grep -v root | awk {'print $2'} | awk '{ SUM += $1} END { print SUM }'`
|
||||
PROCESS=$(ps -eo user=|sort|uniq -c | awk '{ print $2 " " $1 }')
|
||||
PROCESS_ALL=$(echo "$PROCESS"| awk {'print $2'} | awk '{ SUM += $1} END { print SUM }')
|
||||
PROCESS_ROOT=$(echo "$PROCESS"| grep root | awk {'print $2'})
|
||||
PROCESS_USER=$(echo "$PROCESS"| grep -v root | awk {'print $2'} | awk '{ SUM += $1} END { print SUM }')
|
||||
# get processors
|
||||
PROCESSOR_NAME=`grep "model name" /proc/cpuinfo | cut -d ' ' -f3- | awk {'print $0'} | head -1`
|
||||
PROCESSOR_COUNT=`grep -ioP 'processor\t:' /proc/cpuinfo | wc -l`
|
||||
PROCESSOR_NAME=$(grep "model name" /proc/cpuinfo | cut -d ' ' -f3- | awk {'print $0'} | head -1)
|
||||
PROCESSOR_COUNT=$(grep -ioP 'processor\t:' /proc/cpuinfo | wc -l)
|
||||
|
||||
W="\e[0;39m"
|
||||
G="\e[1;32m"
|
||||
|
||||
echo -e "${W}system info:
|
||||
$W Hostname....: $W${HOSTNAME}
|
||||
$W Distro......: $W$(cat /etc/*release | grep "PRETTY_NAME" | cut -d "=" -f 2- | sed 's/"//g')
|
||||
$W Distro......: $W$(grep "PRETTY_NAME" /etc/*release | cut -d "=" -f 2- | sed 's/"//g')
|
||||
$W Kernel......: $W$(uname -sr)
|
||||
$W Uptime......: $W$(uptime -p)
|
||||
$W Load........: $G$LOAD1$W (1m), $G$LOAD5$W (5m), $G$LOAD15$W (15m)
|
||||
|
Loading…
x
Reference in New Issue
Block a user