26 lines
559 B
Bash
Executable File
26 lines
559 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 "%{c}%{F#6d878d}%{T2}λ%{T1}%{F#ffebeb} $(hostname) | $(date "+%H:%M %Y/%m/%d") - $(chkinet) - $(used) - $(apm -l)%"
|
|
sleep $sleep
|
|
done
|