Index: /trunk/MagicSoft/Mars/Changelog
===================================================================
--- /trunk/MagicSoft/Mars/Changelog	(revision 9062)
+++ /trunk/MagicSoft/Mars/Changelog	(revision 9063)
@@ -28,4 +28,9 @@
      - removed not needed variables
      - changed dataset from string to int in call of macro
+
+   * datacenter/scripts/budb
+     - added output how to create database MyMagic
+     - added removing of logfiles
+     - some small inprovements
 
 
Index: /trunk/MagicSoft/Mars/datacenter/scripts/budb
===================================================================
--- /trunk/MagicSoft/Mars/datacenter/scripts/budb	(revision 9062)
+++ /trunk/MagicSoft/Mars/datacenter/scripts/budb	(revision 9063)
@@ -1,32 +1,68 @@
 #!/bin/bash
+#
+# ========================================================================
+#
+# *
+# * This file is part of MARS, the MAGIC Analysis and Reconstruction
+# * Software. It is distributed to you in the hope that it can be a useful
+# * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
+# * It is distributed WITHOUT ANY WARRANTY.
+# *
+# * Permission to use, copy, modify and distribute this software and its
+# * documentation for any purpose is hereby granted without fee,
+# * provided that the above copyright notice appear in all copies and
+# * that both that copyright notice and this permission notice appear
+# * in supporting documentation. It is provided "as is" without express
+# * or implied warranty.
+# *
+#
+#
+#   Author(s): Daniela Dorner  10/2006 <mailto:dorner@astro.uni-wuerzburg.de>
+#
+#   Copyright: MAGIC Software Development, 2000-2008
+#
+#
+# ========================================================================
+#
+# This script backups the Magic Database. 
+# In addition it writes out the commands how to create the database. 
+#
 
-datum=`date +%F`
-dbyd=`date +%F --date="-48hour"`
-
+today=`date +%F`
+olday=`date +%F --date="-30day"`
 
 set -C
 
+path=/home/`whoami`/budb
+logpath=$path/log
+mkdir -pv $logpath
+logfile=$logpath/budb$today.log
+oldlog=$logpath/budb$olday.log
+file=$path/alldatabases
+end=.sql.bz2
+zipfile=$file$today$end
+oldzip=$file$olday$end
 
-path=/home/operator/budb
-logfile=$path/log/budb$datum.log
+dbname=MyMagic
+command=$path/Create$dbname$today.txt
+oldcommand=$path/Create$dbname$olday.txt
 
 date > $logfile
 
-#echo $logfile
+echo "today: $today" >> $logfile 2>&1
+echo "date to remove: $olday" >> $logfile 2>&1
 
-echo "today: $datum" >> $logfile 2>&1
-echo "dbyesterday: $dbyd" >> $logfile 2>&1
+echo "removing old files..." >> $logfile 2>&1
+rm -v $oldzip >> $logfile 2>&1
+rm -v $oldlog >> $logfile 2>&1
+rm -v $oldcommand >> $logfile 2>&1
 
-file=$path/alldatabases
-end=.sql.bz2
-
-dbydfile=$file$dbyd$end
-echo "removing old file..." >> $logfile 2>&1
-
-rm -v $dbydfile >> $logfile 2>&1
-
-echo "writing all databases to file..." >> $logfile 2>&1
+echo "writing all databases to $zipfile..." >> $logfile 2>&1
 set +C
-mysqldump --host=vela --all-databases -u dump | bzip2 -9 -c > $file$datum$end 2>> $logfile
+# complete databases 
+mysqldump --host=vela --all-databases -u dump | bzip2 -9 -c > $zipfile 2>> $logfile
+echo "writing create commands to $command..." >> $logfile 2>&1
+# commands to create MyMagic
+mysqldump --host=vela --database $dbname -u dump --no-data > $command 2>> $logfile
 
 
