ein kleiner bash-Codeschnipsel um aus dem Socket zu lesen und in eine Datei zu schreiben.

This commit is contained in:
Robert Langhammer 2018-08-26 23:28:42 +02:00
parent 31d4e30275
commit 3a55a15806
1 changed files with 21 additions and 0 deletions

21
babel_dump_to_file Executable file
View 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 $$