Files
scripts-bash/get_raspi_info.sh
2026-03-30 15:48:25 -06:00

18 lines
693 B
Bash
Executable File

#!/bin/bash
temp_hdd=$(ssh arthur@192.168.1.131 "sudo smartctl -A /dev/sdb | grep -i temperature")
temp_cpu=$(ssh arthur@192.168.1.131 "vcgencmd measure_temp")
used_mem=$(ssh arthur@192.168.1.131 "free -gth| grep Mem")
used_disk=$(ssh arthur@192.168.1.131 "df -h| grep /dev/sdb2")
temp_hdd_f=$(cut -c 85-90 <<< $temp_hdd)
temp_cpu_f=$(cut -c 6-11 <<< $temp_cpu)
total_mem_f=$(cut -c 16-19 <<< $used_mem)
used_mem_f=$(cut -c 28-31 <<< $used_mem)
used_disk_f1=$(cut -c 29-37 <<< $used_disk)
output="HDD:"$temp_hdd_f"'C "$used_disk_f1"\n""CPU: "$temp_cpu_f"\n""MEM: "$used_mem_f/""$total_mem_f"\n"
echo $output
notify-send -t 15000 -i /home/arthur/scripts/pngegg.png "Raspberry pi" "$output"