Ok I'm dumb... don't saw the braces :-) Bash process substitution will do too #!/bin/sh port="1965" cert="cert.pem" key="key.pem" printf "Starting gemini server on port %s...\n" "$port" while true; do ncat --ssl --ssl-cert "$cert" --ssl-key "$key" --listen "$port" <( \ printf "20 text/gemini; charset=utf-8\r\n" ; \ printf "Page generated: %s\n\n" "$(date)" ; \ cat "$1" ) done freD. ??????? Original Message ??????? On Thursday 25 June 2020 14:09, James Tomasino <tomasino at lavabit.com> wrote: > On 6/25/20 11:34 AM, defdefred wrote: > > > I don't understand how the infinite while works in this case... > > Is it consuming cpu all the time? > > ncat waits only for a single connection, then terminates. I tried using the switch to keep the connection alive and reuse it, but that means the connection is never closed on any single request and most clients display nothing. By wrapping it in an infinite while I just tell ncat to start a new listener when the previous one is used. There's only ever one running at a time, and it's a single thread, but traffic is low and it seems to work just fine.
---
Previous in thread (4 of 6): 🗣️ James Tomasino (tomasino (a) lavabit.com)