This repository has been archived by the owner on Jun 16, 2024. It is now read-only.
forked from reciclanet/SCRIPTS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathetiketa
executable file
·113 lines (86 loc) · 3.57 KB
/
etiketa
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#!/bin/bash
# Copyright 2000-2019 Reciclanet Asociación Educativa-Reciclanet Hezkuntza Elkartea www.reciclanet.org
#
# 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 3 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, see <https://www.gnu.org/licenses/>.
# Computer information: Manufacturer, Model, Serial Number
echo ""
echo ""
MANUFACTURER=$(dmidecode -s system-manufacturer)
echo -e "Fabricante:\t$MANUFACTURER"
MODEL=$(dmidecode -s system-product-name)
echo -e "Modelo:\t\t$MODEL"
SERIAL_NUMBER=$(dmidecode -s system-serial-number)
echo -e "Numero serie:\t$SERIAL_NUMBER"
# Processor characteristics: Model, Architecture, BogoMips
echo ""
PROCESSOR=$(cat /proc/cpuinfo | grep -m 1 "model name" | awk -F: '{print $2}')
echo -e "Procesador:\t$PROCESSOR"
ARCH=$(grep -o -w 'lm' /proc/cpuinfo | sort -u)
if [[ $ARCH = "lm" ]]; then
ARCH=64-bits
else
ARCH=32-bits
fi
echo -e "Arquitectura:\t$ARCH"
BOGOMIPS=$(cat /proc/cpuinfo | grep -m 1 "bogomips" | awk -F' ' '{print $3}')
echo -e "Bogomips:\t$BOGOMIPS"
# Computer memory in MB
echo ""
MEM=$(free -m | grep 'Mem:' | awk -F' ' '{print $2}' | sed 's/ //g')
echo -e "Memoria total:\t$MEM MB"
# Hard disk capacity and partitions
echo ""
HD_SIZE=$(fdisk -l | grep -E "(GB|GiB|MB)")
echo -e "$HD_SIZE"
# Hard Disks details: hours, reallocatd sectors, pendings sectors, errors, and temperature
echo ""
# Enable smartctl and make it not visible on the screen
smartctl -s on /dev/sda >/dev/null 2>&1
HD_HOURS=$(smartctl -a /dev/sda | grep -E '9 Power_On_Hours|9 Power_On_Seconds|9 Power_On_Minutes' | awk -F' - ' '{print $2}' | sed 's/ //g')
echo -e "Horas:\t\t\t$HD_HOURS"
HD_REALLOC=$(smartctl -a /dev/sda | grep '5 Reallocated_Sector_Ct' | awk -F' - ' '{print $2}' | sed 's/ //g')
echo -e "Sectores reubicados:\t$HD_REALLOC"
HD_PENDING_SECTORS=$(smartctl -a /dev/sda | grep '197 Current_Pending_Sector' | awk -F'-' '{print $2}' | sed 's/ //g')
echo -e "Sectores pendientes:\t$HD_PENDING_SECTORS"
HD_ERRORS=$(smartctl -a /dev/sda | grep 'Error Count' | awk -F' ' '{print $4}')
if [[ $HD_ERRORS = "" ]]; then
HD_ERRORS=0
fi
echo -e "Errores:\t\t$HD_ERRORS"
HD_TEMPERATURE=$(smartctl -a /dev/sda | grep '194 Temperature_Celsius' | awk -F' - ' '{print $2}' | sed 's/ //g')
echo -e "Temperatura:\t\t$HD_TEMPERATURE"
# Hard disk read speed
echo ""
for i in $(seq 1 2); do
echo -e "\tPrueba $i:\t$(hdparm -t /dev/sda | grep 'MB/s' | awk -F= '{print $2}' | sed 's/ //g')"
done
# Real battery life
echo ""
# Check computer type: laptop or PC
case $(dmidecode --string chassis-type) in
Laptop | Notebook | Portable | "Sub Notebook")
# Depending on the laptop the value may vary (BAT0, BAT1...) and (charge_full, energy_full)
BATTERY=$(expr \( $(cat /sys/class/power_supply/BAT*/*_full 2>/dev/null) \* 100 \) / $(cat /sys/class/power_supply/BAT*/*_full_design 2>/dev/null) 2>/dev/null )
if [[ $? -eq 0 ]]; then
echo -e "Batería:\t\t$BATTERY%"
else
echo -e "Batería:\t\tPuede que no tenga batería o que este inutilizable"
fi
;;
*) echo "Es un ordenador de sobremesa" ;;
esac
echo ""
echo COPIAR ESTA INFORMACION A LA ETIKETA DEL EQUIPO
echo ""
exit 0