#!/usr/bin/env bash # The Multi-Server Finger Monitor - ver 2.1 # Displays activity from three finger servers within the fingerverse: # https://640kb.neocities.org/fingerverse/index.html # 30may2025: version 2.0 fixes the original messy output with improved # alignment. # 31may2025: version 2.1 fixes the happynetbox output to remove the leading # "> " from the usernames. Now all usernames for the 3 servers are aligned. # The original, in-house version was this subshell (copy/paste to terminal): # (finger @happynetbox.com | sed -n '5,10p'; finger @plan.cat | sed -n '2,7p') # I would add more servers but the few remaining do not output user activity # based on most recent. # I was finding the original sed-based command very useful and wanted to # share (a slightly improved version of it). # .---------- Example (finger @happynetbox.com | sed -n '5,10p') ----------. # | | # | -n : Silences all output by default (no automatic printing). | # | | # | 5,10 : Defines a range: "Start at line 5, end at line 10." | # | | # | p : Prints only the lines in that range. | # | | # '------------------------------------------------------------------------' # install: chmod +x fm && sudo install fm /usr/local/bin # uninstall: sudo rm /usr/local/bin/fm # Usage: fm (or ./fm) # ------------------------------ Start Script ------------------------------- # Verify finger client exists if ! command -v finger &> /dev/null; then echo "Error: finger client not found. Please install finger package." >&2 exit 1 fi format_output() { header="$1" content="$2" server="$3" printf "\n%s\n" "$header" case "$server" in "happynetbox.com") echo "$content" | sed 's/^> //' ;; "plan.cat") echo "$content" | awk '{ username = $1; timestamp = $(NF-4)" "$(NF-3)" "$(NF-2)" "$(NF-1)" "$NF; printf "%-20s %s\n", username, timestamp }' ;; "thebackupbox.net") echo "$content" | awk -F'[/ ]+' '{ date_part = $2; username = $NF; url = substr($0, index($0, "finger://")); printf "%-20s %-15s %s\n", username, date_part, url }' ;; esac } monitor_servers() { # Query happynetbox.com (recent user updates) happynetbox=$(finger @happynetbox.com 2>/dev/null | sed -n '5,10p') format_output "----- happynetbox.com ----" "$happynetbox" "happynetbox.com" # Query plan.cat (user activity with full timestamps) plancat=$(finger @plan.cat 2>/dev/null | sed -n '2,7p') format_output "-------- plan.cat --------" "$plancat" "plan.cat" # Query thebackupbox.net (Finger Ring status) backupbox=$(finger ring@thebackupbox.net 2>/dev/null | sed -n '20,25p') format_output "---- thebackupbox.net ----" "$backupbox" "thebackupbox.net" } # Execute with error handling if ! monitor_servers; then echo "Error: Failed to query one or more finger servers" >&2 exit 1 fi echo -e "\n--------------------------" exit 0 # .-----------------------.---------------.----------------------. # | 640kb.neocities.org | 31 May 2025 | fm@happynetbox.com | # '-----------------------'---------------'----------------------'