diff options
author | Ilya Zverev <zverik@textual.ru> | 2015-07-06 19:03:08 +0300 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 02:54:39 +0300 |
commit | e99003a0d698e45470a620b52dc39f0f55b78005 (patch) | |
tree | 99b5f42425a328d7d0ecfb8c19f2e7c9a879cde8 /tools | |
parent | d22a0519445c8bd449888535a849e0a15eca3757 (diff) |
[generator] Mailing users after build fail or success
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/unix/generate_planet.sh | 9 | ||||
-rwxr-xr-x | tools/unix/test_planet.sh | 4 |
2 files changed, 10 insertions, 3 deletions
diff --git a/tools/unix/generate_planet.sh b/tools/unix/generate_planet.sh index 72e2f37259..0d3e574dea 100755 --- a/tools/unix/generate_planet.sh +++ b/tools/unix/generate_planet.sh @@ -29,6 +29,7 @@ usage() { echo -e "\tREGIONS=\$(ls ../../data/A*.poly) $0" echo -e "NS\tNode storage; use \"map\" when you have less than 64 GB of memory" echo -e "ASYNC_PBF\tGenerate PBF files asynchronously, not in a separate step" + echo -e "MAIL\tE-mail address to send notifications" echo } @@ -137,6 +138,7 @@ TESTING_SCRIPT="$SCRIPTS_PATH/test_planet.sh" LOG_PATH="$TARGET/logs" mkdir -p "$LOG_PATH" PLANET_LOG="$LOG_PATH/generate_planet.log" +[ -n "${MAIL-}" ] && trap "grep STATUS \"$PLANET_LOG\" | mailx -s \"Generate_planet: build failed\" \"$MAIL\"; exit 1" SIGINT SIGTERM log "STATUS" "Start" # Run external script to find generator_tool @@ -390,7 +392,12 @@ fi if [ "$MODE" == "test" ]; then putmode "Step 8: Testing data" - bash "$TESTING_SCRIPT" > "$LOG_PATH/test_planet.log" "$TARGET" + TEST_LOG="$LOG_PATH/test_planet.log" + bash "$TESTING_SCRIPT" "$TARGET" > "$TEST_LOG" + # Send both log files via e-mail + if [ -n "${MAIL-}" ]; then + cat <(grep STATUS "$PLANET_LOG") <(echo ---------------) "$TEST_LOG" | mailx -s "Generate_planet: build completed" "$MAIL" + fi fi # Cleaning up temporary directories diff --git a/tools/unix/test_planet.sh b/tools/unix/test_planet.sh index 170797f343..855661b3e1 100755 --- a/tools/unix/test_planet.sh +++ b/tools/unix/test_planet.sh @@ -25,11 +25,11 @@ echo echo '### LOGS' grep -i 'error\|warn\|critical\|fail\|abort\|останов\|fatal' "$PLANET_LOG" | grep -v 'settings\.ini' for log in "$LOG_PATH"/*.log; do - if [ "$log" != "$PLANET_LOG" ]; then + if [ "$log" != "$PLANET_LOG" -a "$log" != "$LOG_PATH/test_planet.log" ]; then CONTENT="$(grep -i 'error\|warn\|critical\|fail\|abort\|останов\|fatal' "$log" | grep -v 'settings\.ini\|language file for co\|Zero length lin\|too many tokens\|Equal choices for way\|No feature id for way\|number of threads is')" if [ -n "$CONTENT" ]; then echo - echo $log + echo "$log" echo "$CONTENT" fi fi |