Index: /trunk/DataCheck/Tools/get_data.sh
===================================================================
--- /trunk/DataCheck/Tools/get_data.sh	(revision 19043)
+++ /trunk/DataCheck/Tools/get_data.sh	(revision 19044)
@@ -35,7 +35,7 @@
 # ToDo (notes DD): 
 # ----------------
+# - fix bug for timeunit=timestamp (min-binning)
+# - add information on souce, binning, etc to data-file 
 # must-have
-# - fix bug for timeunit=timestamp (min-binning)
-# - add email sending and return values
 # - update function for zd/th-correction
 # - update CU for QLA
@@ -80,21 +80,24 @@
 function print_policy()
 {
-    echo "# Data Usage Policy: "
-    if [ "$expert" == "no" ]
-    then 
-       echo "#   Using data from the FACT Quick Look Analysis, you agree to cite the FACT design"
-       echo "#   paper and the quick look analysis website. "
-       echo "# References: "
-       echo "#   FACT design paper: http://adsabs.harvard.edu/abs/2013JInst...8P6008A"
-       echo "#                      http://iopscience.iop.org/1748-0221/8/06/P06008 "
-       echo "#   FACT Performance Paper: href='http://adsabs.harvard.edu/abs/2014JInst...9P0012B"
-       echo "#                           href='http://iopscience.iop.org/1748-0221/9/10/P10012"
-       echo "#   FACT quick look analysis: https://fact-project.org/monitoring"
-       echo "#                             http://adsabs.harvard.edu/abs/2015arXiv150202582D"
-       echo "# If you intend to use data or information from this website, please let us know for reference."
-    else
-       echo "#   As a member or associated member of the FACT Collaboration, you have access to internal information."
-       echo "#   Any publication using FACT internal information has to have the full FACT author list."
-    fi
+   echo "#" 
+   echo "# Data Usage Policy: "
+   if [ "$expert" == "no" ]
+   then 
+      echo "#   Using data from the FACT Quick Look Analysis, you agree to cite the FACT design"
+      echo "#   paper and the quick look analysis website. "
+      echo "#" 
+      echo "# References: "
+      echo "#   FACT design paper: http://adsabs.harvard.edu/abs/2013JInst...8P6008A"
+      echo "#                      http://iopscience.iop.org/1748-0221/8/06/P06008 "
+      echo "#   FACT Performance Paper: href='http://adsabs.harvard.edu/abs/2014JInst...9P0012B"
+      echo "#                           href='http://iopscience.iop.org/1748-0221/9/10/P10012"
+      echo "#   FACT quick look analysis: https://fact-project.org/monitoring"
+     echo "#                             http://adsabs.harvard.edu/abs/2015arXiv150202582D"
+      echo "# If you intend to use data or information from this website, please let us know for reference."
+   else
+      echo "#   As a member or associated member of the FACT Collaboration, you have access to internal information."
+      echo "#   Any publication using FACT internal information has to have the full FACT author list."
+   fi
+   echo "#" 
 }
     
@@ -344,5 +347,8 @@
       if [ "$overwrite" = "yes" ]
       then 
-         echo "creating "$fileext" ..."
+         if [ "$mode" != "auto" ]
+         then
+            echo "creating "$fileext" ..."
+         fi
          echo "# This file was created at "`date` > $fileext
          print_policy >> $fileext
@@ -362,9 +368,10 @@
    if [ "$overwrite" = "yes" ]
    then 
-      echo "creating "$fileint" ..."
+      if [ "$mode" != "auto" ]
+      then
+         echo "creating "$fileint" ..."
+      fi
       echo "# This file was created at "`date` > $fileint
-      echo "#" >> $fileint
       print_policy >> $fileint
-      echo "#" >> $fileint
       echo "# The following query was used: " >> $fileint
       echo "# "$queryint >> $fileint
@@ -388,7 +395,5 @@
       echo "creating "$filecol" ..."
       echo "# This file was created at "`date` > $filecol
-      echo "#" >> $filecol
       print_policy >> $filecol
-      echo "#" >> $filecol
       echo "# The following query was used: " >> $filecol
       echo "# "$querycol >> $filecol
@@ -401,5 +406,4 @@
    mysql --defaults-file=$sqlpw -u factread --host=$host $dbname -s -e "$querycol" >> $filecol
    #mysql --defaults-file=$sqlpw -u factread --host=$host $dbname -e "$querycol
-   
 }
 
@@ -412,7 +416,6 @@
    overwrite="yes"
    # setup
-   path=`dirname $0`
-   datapath=$path"/data"
-   sqlpw=/home/$USER/.mysql.pw2 
+   datapath="/home/factwww/dch/data"
+   sqlpw=/home/fact/.mysql.pw 
    host=10.0.100.21 
    dbname=factdata 
@@ -421,4 +424,8 @@
    source=$3
    bin=$4
+   if [ "$bin" == "00" ]
+   then
+      bin=0
+   fi
    email=$5
    table=$6
@@ -445,15 +452,12 @@
    get_results
    
+   # sending email
    if [ "$expert" == "yes" ]
    then 
-      echo $fileint
+      cat $fileint | mail -s 'FACT internal data download' -b dorner@astro.uni-wuerzburg.de -r dorner@astro.uni-wuerzburg.de $email
    else
-      echo $fileext
-   fi
-      
-   # next: light, dust
-   # implement all options
-   # make dch swi
-   
+      cat $fileext | mail -s 'FACT data download' -b dorner@astro.uni-wuerzburg.de -r dorner@astro.uni-wuerzburg.de $email
+   fi
+      
    exit
 fi
