Home
check-for-gopher-service.sh - gopher-lawn - The gopher lawn gopher directory project. HTML git clone git://bitreich.org/gopher-lawn/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/gopher-lawn/ DIR Log DIR Files DIR Refs DIR Tags --- check-for-gopher-service.sh (716B) --- 1 #!/bin/sh 2 3 if [ "x$WORKER" = x1 ]; 4 then 5 for port in 70 9999; 6 do 7 # grep using $port because there are cases (at least one) where: 8 # 1. the frontend is accessible on port 70 but is primarily running on port 9999 (the menu is pointing to port 9999) 9 # 2. the frontend is accessible on port 70, the menus are pointing at port 9999, but on port 9999 nothing answers... 10 printf "\r\n" | nc -w 5 "$1" "${port}" 2>/dev/null | \ 11 grep "${port}" | grep -q 'Public Timeline' \ 12 && printf '%s:%s serves gopher\n' "$1" "${port}" && exit 13 done 14 else 15 if [ $# -lt 1 ]; 16 then 17 printf "usage: %s pleroma-servers.txt\n" "$(basename "$0")" >&2 18 exit 1 19 fi 20 21 shuf "$1" | xargs -I '{}' -P 16 sh -c "WORKER=1 '$0' '{}'" 22 fi 23