Compare commits

...

4 Commits

Author SHA1 Message Date
6ae9960091 Fix merge conflict: keeping remote version of screenshot 2026-02-23 22:40:52 +03:00
9179423a62 Replaced screen 2026-02-23 22:35:48 +03:00
d1b6f355f1 Eddited README.md to actual 2026-02-23 22:30:13 +03:00
f71c630006 Added zram info 2026-02-23 22:23:50 +03:00
8 changed files with 158 additions and 51 deletions

View File

@@ -1,38 +0,0 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]
**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]
**Additional context**
Add any other context about the problem here.

View File

@@ -1,10 +0,0 @@
---
name: Custom issue template
about: Describe this issue template's purpose here.
title: ''
labels: ''
assignees: ''
---

62
21-zram Executable file
View File

@@ -0,0 +1,62 @@
#!/bin/bash
# Читаем данные из zramctl [cite: 1]
mapfile -t mem < <( zramctl -b | tail -n +2)
IFS=$'\n' mem=($(sort <<<"${mem[*]}"))
unset IFS
barWidth=38
clear="\e[39m\e[0m"
usageColor="\e[33m"
printf '\nZram:\n'
for point in "${mem[@]}"; do
# Читаем устройство, алгоритм, размер, данные и общий сжатый объем
IFS=" " read -r DEV_PATH ALGO SIZE DATA TOTAL <<<$(echo "${point}" | awk {'print $1,$2,$3,$4,$6'})
DEV_NAME="${DEV_PATH##*/}" # Оставляем только zram0
# Расчеты в GiB с точностью 1 знак
usedGi=$(awk "BEGIN {printf \"%.1f\", $DATA/1024/1024/1024}")
totalGi=$(awk "BEGIN {printf \"%.1f\", $SIZE/1024/1024/1024}")
ratio=$(awk "BEGIN {if ($TOTAL>0) printf \"%.2f\", $DATA/$TOTAL; else print \"1.00\"}")
# Расчет полоски (38 символов) [cite: 1, 4, 5]
usedBarWidth=$((barWidth*DATA/SIZE))
barContent="${usageColor}"
for ((i=0; i<usedBarWidth; i++)); do barContent="${barContent}―"; done
barContent="${barContent}${clear}"
for ((i=0; i<(barWidth-usedBarWidth); i++)); do barContent="${barContent}―"; done
bar="${barContent}${clear}"
# --- ИДЕАЛЬНОЕ ВЫРАВНИВАНИЕ ---
# Строка 1: "zram0" слева, остальное справа.
# Считаем длину правой части без цветовых кодов:
# "used " (5) + usedGi (например "3.6" = 3) + " Gi of " (7) + totalGi ("125.0" = 5) + " Gi" (3) = 23
right_text="used ${usedGi} Gi of ${totalGi} Gi"
right_len=${#right_text}
# Считаем, сколько нужно пробелов между "zram0" (7 симв) и текстом, чтобы в сумме было 38
# 38 - 7 (имя) - длина текста
padding_len=$((38 - 7 - right_len))
padding=""
for ((i=0; i<padding_len; i++)); do padding="${padding} "; done
# Вывод первой строки: 2 пробела + имя + пробелы + текст (с цветом внутри)
printf " %-7s%sused ${usageColor}%s${clear} Gi of %s Gi\n" "$DEV_NAME" "$padding" "$usedGi" "$totalGi"
# Строка 2: Ratio и Algo. Считаем длину, чтобы прижать вправо.
info_text="Ratio: ${ratio} Algo: ${ALGO}"
info_len=${#info_text}
info_padding_len=$((38 - info_len))
info_padding=""
for ((i=0; i<info_padding_len; i++)); do info_padding="${info_padding} "; done
printf " %s%s\n" "$info_padding" "$info_text"
# Линия (2 пробела + 38 символов)
echo -e " ${bar}"
done

28
31-hdd-hours Executable file
View File

@@ -0,0 +1,28 @@
#!/bin/bash
mapfile -t disks < <( ls /dev/sd[a-z] )
out=""
printf "\nHDD Power On Hours:\n"
for i in ${disks[@]}; do
model=$(smartctl -a ${i} | grep "^Device Model:" | awk -F ':' '{print $2}' | xargs 2>/dev/null)
# Получаем «чистые» часы
hours=$(smartctl -a ${i} | grep "^ 9" | awk '{print $10}' | awk -F 'h' '{print $1}' 2>/dev/null)
if [ -n "$hours" ]; then
# Расчеты: 1 год = 8760ч, 1 месяц = 730ч, 1 день = 24ч
y=$((hours / 8760))
m=$(((hours % 8760) / 730))
d=$(((hours % 730) / 24))
time_str=""
[ $y -gt 0 ] && time_str+="${y}y "
[ $m -gt 0 ] && time_str+="${m}m "
[ $d -gt 0 ] && time_str+="${d}d"
[ -z "$time_str" ] && time_str="${hours}h"
out+=" $model...$time_str\n"
fi
done
printf "$out" | column -ts '...'

48
32-hdd-io Executable file
View File

@@ -0,0 +1,48 @@
#!/bin/bash
if ! command -v iostat &> /dev/null; then exit 0; fi
mapfile -t disks < <( ls /dev/sd[a-z] )
out=""
dim="\e[43m"
label="\e[1;30m"
clear="\e[0m\e[39m"
COLUMNS=3
# Берем актуальный %util (вторая итерация iostat)
declare -A utils
while read -r dev util; do
utils[$dev]=$util
done < <(iostat -dx 1 2 | awk '
BEGIN { col=0 }
/%util/ { for(i=1;i<=NF;i++) if($i=="%util") col=i }
col > 0 && $1 ~ /sd[a-z]$/ { data[$1]=$col }
END { for(d in data) print d, data[d] }
')
k=0
printf "\n HDD I/O Load:\n"
for i in "${disks[@]}"; do
dev_name=$(basename "$i")
util="${utils[$dev_name]:-0}"
util_int=$(printf "%.0f" "$util" 2>/dev/null || echo 0)
((k++))
color="\e[42m"
[ "$util_int" -ge 60 ] && color="\e[41m"
[ "$util_int" -lt 60 ] && [ "$util_int" -ge 30 ] && color="\e[43m"
# ФИКСИРОВАННАЯ ШИРИНА:
# %-4s (имя) + %4s (процент) + пробелы внутри тегов.
# Это сделает все плитки одинаковыми.
out+="$(printf "${dim}${label} %-3s ${clear}${color}\e[30m %3s%% ${clear}," "$dev_name" "$util_int")"
if [ $(($k % $COLUMNS)) -eq 0 ]; then
out+="\n"
fi
done
# Выводим с разделителем в 2 пробела между колонками
echo -e "$out" | column -ts $',' -o ' ' | sed -e 's/^/ /'

View File

@@ -31,10 +31,10 @@ for name in $names; do
# color green if service is active, else red
service_status=($(systemctl is-active "$name"))
if [[ "${service_status}" == "active" ]]; then
_tmp=$(printf "%-13s %-16s," "${services[$name]}:" "${green}up${undim}")
_tmp=$(printf "%-13s %-16s," "${services[$name]}:" "${green}${undim}")
out+="${_tmp},"
else
_tmp=$(printf "%-13s %-16s," "${services[$name]}:" "${red}down${undim}")
_tmp=$(printf "%-13s %-16s," "${services[$name]}:" "${red}${undim}")
out+="${_tmp},"
fi
# insert \n every $COLUMNS column

View File

@@ -17,7 +17,8 @@ It just Messange Of The Day for linux ssh and terminal.
- Needed for working module 60-lxd
* ssed
- Needed for working module 70-vpn-active
* zramctl
- Needed for working module 21-zram
# Screenshot
![screen](screenshot/screen.png)
@@ -34,6 +35,10 @@ sudo cp * /etc/update-motd.d/
sudo update-motd
```
# Update 23.02.2026
* Added modules for show zram, hdd io, hdd hours info
# Update 08.09.2021
* Added module for track Openvpn keys (i use easyrsa for generating keys) and active connections

12
config Executable file
View File

@@ -0,0 +1,12 @@
Width=40
#Colors
White="\e[39m"
clear="\e[m"
GREEN="\e[32m"
undim="\e[0m"
RED="\e[31m"
YELLOW="\e[33m"
BLUE="\e[36m"
barclear=""