aboutsummaryrefslogtreecommitdiff
path: root/bin/OpenBSDStatus.sh
diff options
context:
space:
mode:
authorMitchell Riedstra <mitch@riedstra.dev>2024-01-20 12:31:58 -0500
committerMitchell Riedstra <mitch@riedstra.dev>2024-01-20 12:31:58 -0500
commite2a0cf2a79b43f9f86b74270f3d96fe300687804 (patch)
treea87edf55f81e78f4d0968d6f006562090260e068 /bin/OpenBSDStatus.sh
parentec83443853116b07f18fbef8c6de31cf157939a0 (diff)
downloaddotfiles-e2a0cf2a79b43f9f86b74270f3d96fe300687804.tar.gz
dotfiles-e2a0cf2a79b43f9f86b74270f3d96fe300687804.tar.xz
Cleanup unused files and code.
Diffstat (limited to 'bin/OpenBSDStatus.sh')
-rwxr-xr-xbin/OpenBSDStatus.sh108
1 files changed, 0 insertions, 108 deletions
diff --git a/bin/OpenBSDStatus.sh b/bin/OpenBSDStatus.sh
deleted file mode 100755
index 738f11f..0000000
--- a/bin/OpenBSDStatus.sh
+++ /dev/null
@@ -1,108 +0,0 @@
-#!/bin/sh
-timeout=1
-
-_sys_memory() {
- vmstat | sed -n '$p' | awk '{print $4}'
-}
-
-_sys_uptime() {
-uptime | sed -re's/^.*up[ ]+//g' -e's/^([^,]*),.*/\1/g' -e's/^([^ ]+)[ ]*(.).*/\1\2/g'
-}
-
-wireless_info() {
- _if="$1"
-
- printf "WiFi: %s %s %s %s" \
- "$_if" \
- "$(ifconfig "$_if" | sed -nre 's/^.*nwid ([^ ]+).*$/\1/p')" \
- "$(ifconfig "$_if" | sed -nre 's/^.* ([^ ]+dBm) .*$/\1/p')" \
- "$(ifconfig "$_if" | sed -nre 's/^.*inet ([^ ]+).*$/\1/p')"
-}
-
-eth_info() {
- _if="$1"
-
- printf "Eth: %s %s %s" \
- "$_if" \
- "$(ifconfig "$_if" | sed -nre 's/^.*inet ([^ ]+).*$/\1/p')"
- "$(ifconfig "$_if" | grep -oE '[0-9]+baseT')"
-}
-
-network_info() {
- default_if="$(netstat -rnf inet | awk '/^default/{print $8}')"
-
- if [ -z "$default_if" ] ; then
- echo "No conn"
- elif ifconfig "$default_if" | grep -q IEEE802.11 ; then
- wireless_info "$default_if"
- else
- eth_info "$default_if"
- fi
-}
-
-
-ac_status() {
- if [ `apm -a` -eq 1 ] ; then
- echo "charging"
- else
- printf "discharging "
-
- if [ `apm -m` != "unknown" ] ; then
- minutes="$(apm -m)"
- hours="$(echo "$minutes"/60 | bc)"
- hours2="$(echo "$minutes"/60 | bc -l)"
- minutes="$(echo "(${hours2}-${hours})*60" | bc -l )"
- printf "%d hours, %d minutes left" "$hours" "$minutes"
- fi
- fi
-}
-
-cpu_temp() {
- sysctl hw.sensors.cpu0.temp0 \
- | awk -F= '{print $2}' \
- | cut -d' ' -f 1 \
- | cut -d'.' -f 1 \
- | tr -d '\n'
- printf "c"
-}
-
-cpu_fan() {
- sysctl hw \
- | grep fan \
- | awk -F= '{print $2;exit}' \
- | cut -d' ' -f 1 \
- | tr -d '\n'
- printf "rpm"
-}
-
-get_status_simple() {
-echo \
- "Volume: $(sndioctl | awk 'BEGIN{FS="="}{if($1 ~ /output.level/){print ($2+0)*100}}') |"\
- "Fan: $(cpu_fan) |"\
- "Temp: $(cpu_temp) |"\
- "Setperf: $(sysctl hw.setperf | awk -F= '{print $2}') |"\
- "Batt: $(apm -l) $(ac_status)|"\
- "$(network_info) |"\
- "$(date '+%m.%d.%Y %H:%M:%S')"
-}
-
-get_status() {
-echo \
- "Volume: $(sndioctl | awk 'BEGIN{FS="="}{if($1 ~ /output.level/){print ($2+0)*100}}')|"\
- "Temp: $(sysctl hw.sensors.cpu0.temp0 | awk -F= '{print $2}')|"\
- "Fan: $(sysctl hw | grep fan | awk -F= '{print $2;exit}')|"\
- "Cpu Freq: $(sysctl hw.cpuspeed | awk -F= '{print $2}')mhz|"\
- "Setperf: $(sysctl hw.setperf | awk -F= '{print $2}')|"\
- "Batt: $(apm -l) $(ac_status)|"\
- "$(network_info) |"\
- "Free Mem: $(_sys_memory)|"\
- "uptime: $(_sys_uptime)|"\
- "$(date '+%m.%d.%Y %H:%M:%S')"
-}
-
-while true ; do
-
-xsetroot -name "$(get_status_simple)"
-
-sleep "$timeout"
-done