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.
|
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
|
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
|
mkdir -p /etc/update-motd.d/ # create dedicated directory following ubuntu
|
||||||
cp motd /etc/update-motd.d/ # copy the static motd banner into it
|
cp motd /etc/update-motd.d/ # copy the static motd banner into it
|
||||||
chmod -x /etc/update-motd.d/* # disable any existing script
|
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 "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"
|
echo "session optional pam_exec.so stdout /etc/update-motd.d/00-basic"
|
||||||
|
@ -4,24 +4,24 @@
|
|||||||
cat $(dirname $0)/motd
|
cat $(dirname $0)/motd
|
||||||
|
|
||||||
# get load averages
|
# 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
|
# get free memory
|
||||||
IFS=" " read USED AVAIL TOTAL <<<$(free -htm | grep "Mem" | awk {'print $3,$7,$2'})
|
IFS=" " read USED AVAIL TOTAL <<<$(free -htm | grep "Mem" | awk {'print $3,$7,$2'})
|
||||||
# get processes
|
# get processes
|
||||||
PROCESS=`ps -eo user=|sort|uniq -c | awk '{ print $2 " " $1 }'`
|
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_ALL=$(echo "$PROCESS"| awk {'print $2'} | awk '{ SUM += $1} END { print SUM }')
|
||||||
PROCESS_ROOT=`echo "$PROCESS"| grep root | awk {'print $2'}`
|
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_USER=$(echo "$PROCESS"| grep -v root | awk {'print $2'} | awk '{ SUM += $1} END { print SUM }')
|
||||||
# get processors
|
# get processors
|
||||||
PROCESSOR_NAME=`grep "model name" /proc/cpuinfo | cut -d ' ' -f3- | awk {'print $0'} | head -1`
|
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_COUNT=$(grep -ioP 'processor\t:' /proc/cpuinfo | wc -l)
|
||||||
|
|
||||||
W="\e[0;39m"
|
W="\e[0;39m"
|
||||||
G="\e[1;32m"
|
G="\e[1;32m"
|
||||||
|
|
||||||
echo -e "${W}system info:
|
echo -e "${W}system info:
|
||||||
$W Hostname....: $W${HOSTNAME}
|
$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 Kernel......: $W$(uname -sr)
|
||||||
$W Uptime......: $W$(uptime -p)
|
$W Uptime......: $W$(uptime -p)
|
||||||
$W Load........: $G$LOAD1$W (1m), $G$LOAD5$W (5m), $G$LOAD15$W (15m)
|
$W Load........: $G$LOAD1$W (1m), $G$LOAD5$W (5m), $G$LOAD15$W (15m)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user