-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsystem-check
executable file
·34 lines (28 loc) · 1.34 KB
/
system-check
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
#!/bin/bash
source ~/Repositories/scripts/essential-functions
logdir="$HOME/.local/logs/system-check"
checktime=$(date-string)
logtime="$(echo -n $checktime | cut -c-8)"
function process-exists {
echolor white-green ":: ““[CHECK]”” process ““$1”” exists."
}
function process-missing {
echolor white-red ":: ““[ERROR]”” process ““$1”” does NOT exist."
}
function process-check {
[[ -z "$(pgrep --full "$1")" ]] && {
process-missing "$2"
echo "$checktime,ERROR,$1,NOPID" >> "$logdir"/system-check-"$logtime".log
} || {
process-exists "$2"
echo "$checktime,CHECK,$1,$(pgrep --full "$1")" >> "$logdir"/system-check-"$logtime".log
}
}
echolor green-yellow ":: Kernel:\t““$(uname -r)””"
echolor green-yellow ":: Uptime:\t““$(uptime -p | sed 's/up //g')””"
echolor green-yellow ":: Battery:\t““$(upower -i /org/freedesktop/UPower/devices/battery_BAT1 | grep perce | awk '{print $2}')””"
echolor green-yellow ":: Memory:\t““$(df | grep sda1 | awk '{print $5}')””"
echolor green-yellow ":: Brightness:\t““$(brightnessctl i | grep Current | awk '{print $4}' | tr -d '()')””"
echolor green-yellow ":: Fan speed:\t““$(cat /proc/acpi/ibm/fan | grep speed | awk '{print $NF}')””"
process-check "battery-warner" "battery warner"
process-check 'emacs --daemon' "emacs daemon"