1
Fork 0
satellite/home/features/cli/scripts/uptimes.sh
Matei Adriel 424a1db3a7
Improve setup in many small ways
- ircgay command for catgirl
- fish keybinds for launching $EDITOR
- uptimes script
- fix neovide launch flags
2024-02-09 19:18:33 +01:00

22 lines
518 B
Bash
Executable file

print_uptime() {
local HOST=$1
local EMOJI=$2
# -n: do not echo a newline
echo -n "$EMOJI $HOST: "
# The output of `uptime` looks like this:
# `18:40:54 up 1 day 0:51, 0 users, load average: 0.79, 0.68, 0.69`,
# so we use awk to trim it down to the parts we care about.
#
# For awk:
# -F: splits the input by a string
ssh adrielus@$HOST uptime \
| awk -F "up" '{print $2}' \
| awk -F " " '{print $1, $2}'
}
echo "Uptimes:"
print_uptime "tethys" "🔥"
print_uptime "lapetus" "⛵"