Index: trunk/tools/mysql-dump/gpc1_install.sh
===================================================================
--- trunk/tools/mysql-dump/gpc1_install.sh	(revision 31209)
+++ trunk/tools/mysql-dump/gpc1_install.sh	(revision 31211)
@@ -1,6 +1,19 @@
 #!/bin/bash
 
-# This script is supposed to be executed on ipp001
+# This script is supposed to be executed on ipp001 (HOST)
+#
+# It checks, 'installs', and 'distributes' the last gpc1 MySQL dump.
+# The main steps are the following:
+# 1) Check if a checksum file is available
+#    - if it is not, the script sleeps $SLEEPING_TIME seconds, and
+#      iterates up to $MAX_ITERATIONS times.
+# 2) Check the gpc1 dump file against its checksum.
+# 3) Import gpc1 into gpc1_0 or gpc1_1 (ensured by gpc1Import.py utility)
+# 4) Distribute the validated files, that is:
+#    - Hard-links the gzipped MySQL dump in the distribution directory
+#    - Moves the MD5 checksum to the distribution directory
 . /home/panstarrs/ipp/mysql-dump/functions.sh
+
+EMAILTO=schastel@ifa.hawaii.edu
 
 HOST=ipp001
@@ -9,4 +22,5 @@
 
 DISTRIBUTION_TARGET=$TARGET/distribution/ippdb01-gpc1.dump.gz
+DISTRIBUTION_MD5=$TARGET/distribution/ippdb01-gpc1.md5
 
 MAX_ITERATIONS=200
@@ -22,4 +36,5 @@
 	if [ "$ITERATION" -ge "$MAX_ITERATIONS" ]; then
 		log ERROR "Copy of $TARGET/$MD5FILE failed after $ITERATION iterations. Giving up"
+		email "Too many failures when attempting to copy $TARGET/$MD5FILE" $EMAILTO "Check log"
 		exit 1
 	fi
@@ -34,4 +49,5 @@
 if [ "$ACTUAL_MD5SUM" != "$EXPECTED_MD5SUM" ]; then
         log ERROR "Checksums are different: actual=[$ACTUAL_MD5SUM], expected=[$EXPECTED_MD5SUM]"
+	email "Invalid checksum for gpc1 backup" $EMAILTO "Checksums are different: actual=[$ACTUAL_MD5SUM], expected=[$EXPECTED_MD5SUM]"
         exit 2
 fi
@@ -42,3 +58,4 @@
 log INFO "Symlinking backup file [$TARGET/$BACKUP_FILE] to distribution [$DISTRIBUTION_TARGET]"
 /usr/bin/ln -f $TARGET/$BACKUP_FILE $DISTRIBUTION_TARGET
+/usr/bin/mv -f $TARGET/$MD5FILE $DISTRIBUTION_MD5
 
