-
Notifications
You must be signed in to change notification settings - Fork 6
/
motd
86 lines (85 loc) · 3.79 KB
/
motd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#!/bin/bash
# chmod a+x 00-main
# sudo mv 00-main /etc/update-motd.d/
# Для вычисления uptime используеться bc (Калькулятор произвольной точности)
# sudo apt-get install bc
#
# My Info
#
# Colors
#
W='\e[1;37m' # White
UW='\e[4;37m' # Under_White
R='\e[1;31m' # Red
G='\e[1;32m' # Green
Y='\e[1;33m' # Yellow
B='\e[1;34m' # Blue
RE='\e[0m' # Text Reset
#
# Variables
#
UPTIME=`cat /proc/uptime | sed -r 's/ .+//g'`
UPDAY=`echo "$UPTIME/3600/24" | bc`
UPHRS=`echo "$UPTIME/3600" | bc`
UPMINS=`echo "($UPTIME-$UPHRS*3600)/60" | bc`
UPSECS=`echo "($UPTIME-$UPHRS*3600-$UPMINS*60)/1" | bc`
#
HOSTNAME=`uname -n`
KERNEL=`uname -r`
CPU=`cat /proc/cpuinfo | grep -m 1 "model name" | cut -d":" -f2- | cut -d" " -f2-`
ARCH=`uname -m`
MEM=`cat /proc/meminfo | grep MemTotal | cut -d" " -f9-`
TIME=`date +%T`
DATE=`date +%d`
MONTH=`date +%B`
WEEK=`date +%A`
YEAR=`date +%Y`
#
# MB=`sensors | grep temp1 | cut -d":" -f2- | cut -d"(" -f1 | cut -b10-16`
# CPU0=`sensors | grep "Core 0"| cut -d":" -f2- | cut -d"(" -f1 | cut -b9-16`
# CPU1=`sensors | grep "Core 1"| cut -d":" -f2- | cut -d"(" -f1 | cut -b9-16`
MB_VENDOR=`cat /sys/devices/virtual/dmi/id/board_vendor`
MB_NAME=`cat /sys/devices/virtual/dmi/id/board_name`
MB_VERSION=`cat /sys/devices/virtual/dmi/id/board_version`
#
PROC=`cat /proc/cpuinfo | grep -c ^processor`
PROCS=`ps -A h | wc -l`
#
HOMES=`df -h | grep /sda | grep /home | cut -d"%" -f1 | cut -b"41-42"`
SYSTEM=`df -h | grep /sda | grep -m 1 "/" | cut -d"%" -f1 | cut -b"41-42"`
BOOT=`df -h | grep /sda | grep /boot | cut -d"%" -f1 | cut -b"41-42"`
#
IP=`ifconfig |grep "inet addr"|grep -v 127.0.0.1|awk {' print $2'}|awk -F : {' print $2'}`
#
clear
echo -e $B"=============================================================================== "$W
echo -e $B"| $R Добро пожаловать в систему "$W
echo -e $B"=============================================================================== "$W
echo -e $B"| $UW Системная дата $RE "$W
echo -e $B"| $W Сегодня : $G"$WEEK"$W День : $G"$DATE"$W Месяц : $G"$MONTH"$W Год : $G"$YEAR" "$W
echo -e $B"| $W Время : $G"$TIME" "$W
echo -e $B"| $W Время работы системы : $G"$UPDAY дней" "$W
echo -e $B"| $W Точное время работы системы : $G"$UPHRS часов $UPMINS минут $UPSECS секунд" "$W
echo -e $B"=============================================================================== "$W
echo -e $B"| $UW Системная информация $RE "$W
echo -e $B"| $W Имя хоста : $G"$HOSTNAME" "$W
echo -e $B"| $W Мат плата : $G"$MB_VENDOR $MB_NAME $MB_VERSION" "$W
echo -e $B"| $W Ядро : $G"$KERNEL" "$W
echo -e $B"| $W Процессор : $G"$CPU" "$W
echo -e $B"| $W Архитектура : $G"$ARCH" "$W
echo -e $B"| $W Память : $G"$MEM" "$W
echo -e $B"=============================================================================== "$W
echo -e $B"| $UW Информация о ресурсах $RE "$W
echo -e $B"| $W Количество ядер : $G"$PROC" "$W
echo -e $B"| $W Запущено процессов : $G"$PROCS" "$W
echo -e $B"| $UW Дисковое пространство $RE "$W
echo -e $B"| $W Использовано в папке / : $G"$SYSTEM"% "$W
echo -e $B"| $W Использовано в папке home : $G"$HOMES"% "$W
echo -e $B"| $W Использовано в папке boot : $G"$BOOT"% "$W
echo -e $B"=============================================================================== "$W
echo -e $B"| $UW Информация о сети $RE "$W
echo -e $B"| $W Сетевые адреса : $G"$IP" "$W
echo -e $B"=============================================================================== "$W
echo -e "\n"$RE
exit 0
==========================================================================