Colin Watson has proposed merging 
~cjwatson/launchpad-bastion-scripts:rsync-scripts into 
launchpad-bastion-scripts:main.

Commit message:
Add rsync log-handling scripts from carob

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad-bastion-scripts/+git/launchpad-bastion-scripts/+merge/450565

We're moving the function of "system from which we can read Launchpad 
production logs" from carob to the PS5 Launchpad bastion, so it would be 
helpful to have some convenience scripts in `stg-launchpad`'s search path.  
People have been copying these around from my home directory for a while, so 
having them in revision control would be no bad thing.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~cjwatson/launchpad-bastion-scripts:rsync-scripts into 
launchpad-bastion-scripts:main.
diff --git a/rcat b/rcat
new file mode 100755
index 0000000..26f2ad5
--- /dev/null
+++ b/rcat
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+REMOTE=$1
+TEMPFILE=$(mktemp)
+
+cleanup () {
+        if [ "$SEED" ]; then
+                cp -a "$TEMPFILE" "$SEED"
+        fi
+        rm -f "$TEMPFILE"
+}
+trap cleanup EXIT HUP INT QUIT TERM
+
+if [ "$SEED" ]; then
+        cp -a "$SEED" "$TEMPFILE"
+fi
+rsync -q "$REMOTE" "$TEMPFILE"
+case $REMOTE in
+        *.gz)   zcat "$TEMPFILE" ;;
+        *.bz2)  bzcat "$TEMPFILE" ;;
+        *.xz)   xzcat "$TEMPFILE" ;;
+        *)      cat "$TEMPFILE" ;;
+esac
diff --git a/rless b/rless
new file mode 100755
index 0000000..5d7829c
--- /dev/null
+++ b/rless
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+REMOTE=$1
+TEMPFILE=$(mktemp)
+PATTERN=$2
+
+cleanup () {
+        if [ "$SEED" ]; then
+                cp -a "$TEMPFILE" "$SEED"
+        fi
+        rm -f "$TEMPFILE"
+}
+trap cleanup EXIT HUP INT QUIT TERM
+
+if [ "$SEED" ]; then
+        cp -a "$SEED" "$TEMPFILE"
+fi
+case $REMOTE in
+        *.gz)   SHOW="zcat $TEMPFILE" ;;
+        *.bz2)  SHOW="bzcat $TEMPFILE" ;;
+        *.xz)   SHOW="xzcat $TEMPFILE" ;;
+        *)      SHOW="cat $TEMPFILE" ;;
+esac
+if [ "$PATTERN" ]; then
+        SHOW="$SHOW | egrep \"$PATTERN\""
+fi
+rsync -q "$REMOTE" "$TEMPFILE"
+eval "$SHOW" | less
diff --git a/rtail b/rtail
new file mode 100755
index 0000000..035f55b
--- /dev/null
+++ b/rtail
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+REMOTE=$1
+TEMPFILE=$(mktemp)
+PATTERN=$2
+
+cleanup () {
+        if [ "$SEED" ]; then
+                cp -a "$TEMPFILE" "$SEED"
+        fi
+        rm -f "$TEMPFILE"
+}
+trap cleanup EXIT HUP INT QUIT TERM
+
+if [ "$SEED" ]; then
+        cp -a "$SEED" "$TEMPFILE"
+fi
+case $REMOTE in
+        *.gz)   SHOW="zcat $TEMPFILE" ;;
+        *.bz2)  SHOW="bzcat $TEMPFILE" ;;
+        *.xz)   SHOW="xzcat $TEMPFILE" ;;
+        *)      SHOW="cat $TEMPFILE" ;;
+esac
+if [ "$PATTERN" ]; then
+        SHOW="$SHOW | egrep \"$PATTERN\""
+fi
+watch -n5 "rsync -q $REMOTE $TEMPFILE; $SHOW | tail -n$(($(tput lines) - ${ROWS_GRACE:-6})) | cut -c1-$(tput cols)"
_______________________________________________
Mailing list: https://launchpad.net/~launchpad-reviewers
Post to     : launchpad-reviewers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~launchpad-reviewers
More help   : https://help.launchpad.net/ListHelp

Reply via email to