diff options
| author | Sam Nystrom <sam@samnystrom.dev> | 2026-01-13 18:07:21 -0500 |
|---|---|---|
| committer | Sam Nystrom <sam@samnystrom.dev> | 2026-01-13 18:07:21 -0500 |
| commit | f24f6ea00f245e0ba1e593f954267f7eefd59c8a (patch) | |
| tree | 1ceb6037c1c94d403e2748039f6fe35f561cdbf1 /bin/uptime-json | |
| parent | cfa85684d648c8a3b1417ab01cb9acb8dd7f15c6 (diff) | |
update eww config
Diffstat (limited to 'bin/uptime-json')
| -rwxr-xr-x | bin/uptime-json | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/bin/uptime-json b/bin/uptime-json new file mode 100755 index 0000000..7e9a87d --- /dev/null +++ b/bin/uptime-json @@ -0,0 +1,20 @@ +#!/bin/sh + +uptime="$(uptime)" +uptime="${uptime#*up }" + +d=0 +case "$uptime" in + *day*) + d="${uptime%% *}" + uptime="${uptime#*, }" + ;; +esac + +h="${uptime%%:*}" +h="${h#0}" +uptime="${uptime#*:}" +m="${uptime%%,*}" +m="${m#0}" + +printf '{"d":%d,"h":%d,"m":%d}\n' "$d" "$h" "$m" |
