restart import if last run produced errors
authorDobrica Pavlinusic <dpavlin@rot13.org>
Tue, 22 Jan 2013 19:02:34 +0000 (20:02 +0100)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Tue, 22 Jan 2013 19:02:34 +0000 (20:02 +0100)
import-pgsql-dump.sh

index f7b7dcf..5c97175 100755 (executable)
@@ -1,9 +1,12 @@
 #!/bin/sh -xe
 
+echo started on `date`
 touch errors
 (
 psql -l | grep ibatisti | awk '{ print $1 }' | xargs -i dropdb {}
 ./pgsql-fix-value-too-long.pl errors $1 | \
 ( psql --echo-queries template1 2>&1 )
 2>&1 ) | tee log
-grep -A 1 'value too long' log | tee -a errors
+grep -A 1 'value too long' log | tee -a errors 
+mv log log.last
+grep 'value too long' log.last && exec $0 $*