Hello,

for years have i been using a self-made backup script, that did mount a
drive via USB, performed all kinds of plausibility checks, before
actually backing up incrementally. Finally verifying success and logging
the activities while kicking the ISB drive out.

Since a few months, i do have a real backup server instead, connecting
to it via ssh i was able to have 2 terminals open and back up manually.
Last time, i introduced a mistake by accident and since, i am trying to
automate the whole thing once again, but that is difficult, as the load
on the net is huge, mbuffer is useful in that regard. So i was intending
to have just one script for all the operations using coproc to
coordinate the 2 servers.

But weird things are going on, i cant reliably communicate between host
and backup server, at least not automatically.

Searching the web, i found:
https://github.com/reconquest/coproc.bash/blob/master/REFERENCE.md
But i was unable to get this to work, which seems to indicate, that i am
misunderstanding something.
The only success i had was to "talk" to a chess engine in a coprocess,
which did go well. But neither bash nor ssh are cooperating, i may have
timing issues with the pipes or some other side effects.

How can i describe? For example if i start this:
> #!/bin/bash -e
> 
> coproc { bash; }
> exec 5<&${COPROC[0]} 6>&${COPROC[1]}
> fd=5
> 
> echo "ls" >&6
> while IFS= read -ru $fd line
> do
>     printf '%s\n' "$line"
> done
> 
> printf "%s\n" "sleep 3;exit" >&6
> while IFS= read -ru $fd line
> do
>     printf '%s\n' "$line"
> done
> 
> exec 5<&- 6>&-
> 
> wait
> echo waited, done

i get the output from ls, but then the thing is hanging indefinitely,
apparently not reaching the exit line. :(

Anyone who can share his experience to advance my experimenting?
DdB

Reply via email to