dotfiles/.local/bin/bar

27 lines
535 B
Bash
Executable File

#!/usr/bin/env sh
sleep=1
used() {
used=$(vmstat | awk 'END {printf $3}' | tr -d "M")
full=$(expr $(sysctl -n hw.usermem) / 1048576)
echo "$used/$full"
}
chkinet() {
#int=$(ifconfig | grep -E "UP,BROADCAST,RUNNING" | cut -f1 -d ":")
int=iwx0
out=$(ifconfig "$int" | grep "status" | cut -f2 -d ":" | tr -d " ")
case "$out" in
"active") echo "up"; ;;
"nonetwork") echo "down"; ;;
esac
}
while true; do
echo "%{r}$USER@$(hostname) - $(date "+%Y-%m-%d %H:%M %Z") - $(chkinet) - $(used) - $(apm -l)% "
sleep $sleep
done