Lokal Profil has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/312207

Change subject: Shell script for extracting the last full log
......................................................................

Shell script for extracting the last full log

A script which can be run from anyware on toollabs to extract the
log from the last complete run. Useful for isolating errors etc.

Note that this will not catch the logs for runs which fail so
fatally that the update_monuments.sh script fails to output its
final log line.

Change-Id: I15e96ff856a954bbdcb44529632d1f2edcdfc455
---
A bin/extract_last_full_log.sh
1 file changed, 29 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/labs/tools/heritage 
refs/changes/07/312207/1

diff --git a/bin/extract_last_full_log.sh b/bin/extract_last_full_log.sh
new file mode 100755
index 0000000..5ce5103
--- /dev/null
+++ b/bin/extract_last_full_log.sh
@@ -0,0 +1,29 @@
+#!/bin/bash
+#
+# Script to make a local copy of the last complete log
+
+# make a local copy of the logs
+cp /data/project/heritage/logs/update_monuments.log ./raw.log;
+
+# cut log at last complete
+last_complete=$(grep --binary-files=text -n "Done with the update!" raw.log | 
tail -n1 | cut -f1 -d:);
+# echo "last_complete: $last_complete";
+head -n "$last_complete" raw.log > tmp.log;
+
+# keep only last log
+log_length=$(wc -l tmp.log | cut -f1 -d' ');
+# echo "log_length: $log_length";
+last_start=$(grep --binary-files=text -n "Starting full monument update" 
tmp.log | tail -n1 | cut -f1 -d:);
+# echo "last_start: $last_start";
+cut_line=$((log_length - last_start + 1));
+tail -n "$cut_line" tmp.log > update_monuments.log;
+
+# output info on isolated log
+log_length=$(wc -l update_monuments.log | cut -f1 -d' ');
+start_time=$(head -n1 update_monuments.log | cut -f1 -d' ');
+end_time=$(tail -n1 update_monuments.log | cut -f1 -d' ');
+echo "update_monuments.log: ($start_time -- $end_time) $log_length lines";
+
+# clean up
+rm raw.log;
+rm tmp.log;

-- 
To view, visit https://gerrit.wikimedia.org/r/312207
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I15e96ff856a954bbdcb44529632d1f2edcdfc455
Gerrit-PatchSet: 1
Gerrit-Project: labs/tools/heritage
Gerrit-Branch: master
Gerrit-Owner: Lokal Profil <lokal.pro...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to