#!/bin/sh
-cat log | grep "Mesh for peer" > __tmp_peers
+cp log .log
+cat .log | grep "Mesh for peer" > __tmp_peers
cat __tmp_peers | while read line; do
PEER=`echo $line | sed -e 's/.*\[\(....\)\].*/\1/'`
PID=`echo $line | sed -e 's/.*mesh-\([0-9]*\).*/\1/'`
echo "$PID => $PEER"
- cat log | sed -e "s/mesh-$PID/MESH $PEER/" > __tmp_log
- mv __tmp_log log
+ cat .log | sed -e "s/mesh-\([a-z2]*\)-$PID/MESH \1 $PEER/" > .log2
+ mv .log2 .log
done
rm __tmp_peers
-cat log | sed -e 's/mesh2-api-/mesh2-api- /g' > __tmp_log
-mv __tmp_log log
-
-kwrite log --geometry 960x1140-960 &
+cat .log | sed -e 's/mesh-api-/mesh-api- /g' > .log2
+mv .log2 .log
+if [[ "`ps aux | grep "kwrite .lo[g]"`" = "" ]]; then
+ kwrite .log --geometry 960x1140-960 &
+fi