Init commit

This commit is contained in:
2019-12-18 13:52:45 +01:00
commit 18ca3d2c2d
11 changed files with 1519 additions and 0 deletions

38
motd/10-sysinfo Executable file
View File

@@ -0,0 +1,38 @@
#!/bin/bash
#
# 10-sysinfo - generate the system information
# Copyright (c) 2013 Nick Charlton
#
# Authors: Nick Charlton <hello@nickcharlton.net>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
cpuallusage=`ps aux | awk {'sum+=$3;print sum'} | tail -n 1 | awk '{printf "%.0f\n", $1}'`
cpucores=`cat /proc/cpuinfo | grep "model name" | wc -l`
cpuusage=$((cpuallusage / cpucores))
# \033[0;34m+ \033[0;37mCPU usage \033[0;34m= \033[1;32m$cpuusage%
echo -e "\033[0;34m+++++++++++++++++: \033[0;37mSystem Data\033[0;34m :+++++++++++++++++++++++++++++
\033[0;34m+ \033[0;37mDate and Time \033[0;34m= \033[1;32m`date`
\033[0;34m+ \033[0;37mKernel \033[0;34m= \033[1;32m`uname -r`
\033[0;34m+ \033[0;37mUptime \033[0;34m= \033[1;32m`uptime | grep -ohe 'up .*' | sed 's/,//g' | awk '{ printf $2" "$3 }'`
\033[0;34m+ \033[0;37mLoad \033[0;34m= \033[1;32m`cat /proc/loadavg | awk '{print $1}'` `cat /proc/loadavg | awk '{print $2}'` `cat /proc/loadavg | awk '{print $3}'`
\033[0;34m+ \033[0;37mCPU model \033[0;34m= \033[1;32m$cpucores x `cat /proc/cpuinfo | grep -m 1 "model name" | awk -F ": " '{print $2}'`
\033[0;34m+ \033[0;37mMemory \033[0;34m= \033[1;32mUsed `free -m | head -n 3 | tail -n 1 | awk {'print $3'}` MB out of `free -m | head -n 2 | tail -n 1 | awk {'print $2'}` MB
\033[0;34m+ \033[0;37mHDD \033[0;34m= \033[1;32mUsed `df -h / | tail -n 1 | awk {'print $3'}` out of `df -h / | tail -n 1 | awk {'print $2'}`
\033[0;34m+ \033[0;37mProcesses \033[0;34m= \033[1;32m`ps aux | wc -l` of `ulimit -u` MAX
\033[0;34m+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\033[0;37m
"