2023-07-06 01:58:18 +02:00
|
|
|
#!/usr/bin/env sh
|
2022-12-20 12:02:52 +01:00
|
|
|
|
2023-07-06 01:58:18 +02:00
|
|
|
sleep=1
|
2023-02-08 01:42:20 +01:00
|
|
|
|
|
|
|
used() {
|
|
|
|
used=$(vmstat | awk 'END {printf $3}' | tr -d "M")
|
|
|
|
full=$(expr $(sysctl -n hw.usermem) / 1048576)
|
|
|
|
|
2023-07-07 16:45:46 +02:00
|
|
|
echo "$used/$full"
|
2023-02-08 01:42:20 +01:00
|
|
|
}
|
|
|
|
|
2023-07-06 01:58:18 +02:00
|
|
|
chkinet() {
|
2024-02-04 02:44:04 +01:00
|
|
|
#int=$(ifconfig | grep -E "UP,BROADCAST,RUNNING" | cut -f1 -d ":")
|
|
|
|
int=iwx0
|
|
|
|
out=$(ifconfig "$int" | grep "status" | cut -f2 -d ":" | tr -d " ")
|
2023-07-06 01:58:18 +02:00
|
|
|
|
|
|
|
case "$out" in
|
|
|
|
"active") echo "Up"; ;;
|
|
|
|
"nonetwork") echo "Down"; ;;
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
2022-10-02 00:16:21 +02:00
|
|
|
while true; do
|
2024-02-04 02:44:04 +01:00
|
|
|
echo "%{r}$USER@$(hostname) - $(date "+%Y-%m-%d %H:%M %Z") - $(chkinet) - $(used) - $(apm -l)% "
|
2023-07-06 01:58:18 +02:00
|
|
|
sleep $sleep
|
2022-10-02 00:16:21 +02:00
|
|
|
done
|