From 3a55a1580681040511529b36d5104abf805002e6 Mon Sep 17 00:00:00 2001 From: Robert Langhammer Date: Sun, 26 Aug 2018 23:28:42 +0200 Subject: [PATCH] ein kleiner bash-Codeschnipsel um aus dem Socket zu lesen und in eine Datei zu schreiben. --- babel_dump_to_file | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 babel_dump_to_file diff --git a/babel_dump_to_file b/babel_dump_to_file new file mode 100755 index 0000000..39a0452 --- /dev/null +++ b/babel_dump_to_file @@ -0,0 +1,21 @@ +#!/bin/bash +[ $# != 1 ] && echo "parameter tmpfile missing!" && exit +tmpfile=$1 + +# bind babel-socket to FD3 +exec 3<>/dev/tcp/::1/33123 + +# read and write data +cat <&3 > "$tmpfile" & + +# write "dump" to sock +echo dump >&3 + +# Wait a moment and close FD3 +sleep 0.1 +exec 3<&- + +# and clean up +pkill -P $$ + +