Changeset 9063 for trunk/MagicSoft/Mars/datacenter/scripts
- Timestamp:
- 07/31/08 17:44:49 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/datacenter/scripts/budb
r8380 r9063 1 1 #!/bin/bash 2 # 3 # ======================================================================== 4 # 5 # * 6 # * This file is part of MARS, the MAGIC Analysis and Reconstruction 7 # * Software. It is distributed to you in the hope that it can be a useful 8 # * and timesaving tool in analysing Data of imaging Cerenkov telescopes. 9 # * It is distributed WITHOUT ANY WARRANTY. 10 # * 11 # * Permission to use, copy, modify and distribute this software and its 12 # * documentation for any purpose is hereby granted without fee, 13 # * provided that the above copyright notice appear in all copies and 14 # * that both that copyright notice and this permission notice appear 15 # * in supporting documentation. It is provided "as is" without express 16 # * or implied warranty. 17 # * 18 # 19 # 20 # Author(s): Daniela Dorner 10/2006 <mailto:dorner@astro.uni-wuerzburg.de> 21 # 22 # Copyright: MAGIC Software Development, 2000-2008 23 # 24 # 25 # ======================================================================== 26 # 27 # This script backups the Magic Database. 28 # In addition it writes out the commands how to create the database. 29 # 2 30 3 datum=`date +%F` 4 dbyd=`date +%F --date="-48hour"` 5 31 today=`date +%F` 32 olday=`date +%F --date="-30day"` 6 33 7 34 set -C 8 35 36 path=/home/`whoami`/budb 37 logpath=$path/log 38 mkdir -pv $logpath 39 logfile=$logpath/budb$today.log 40 oldlog=$logpath/budb$olday.log 41 file=$path/alldatabases 42 end=.sql.bz2 43 zipfile=$file$today$end 44 oldzip=$file$olday$end 9 45 10 path=/home/operator/budb 11 logfile=$path/log/budb$datum.log 46 dbname=MyMagic 47 command=$path/Create$dbname$today.txt 48 oldcommand=$path/Create$dbname$olday.txt 12 49 13 50 date > $logfile 14 51 15 #echo $logfile 52 echo "today: $today" >> $logfile 2>&1 53 echo "date to remove: $olday" >> $logfile 2>&1 16 54 17 echo "today: $datum" >> $logfile 2>&1 18 echo "dbyesterday: $dbyd" >> $logfile 2>&1 55 echo "removing old files..." >> $logfile 2>&1 56 rm -v $oldzip >> $logfile 2>&1 57 rm -v $oldlog >> $logfile 2>&1 58 rm -v $oldcommand >> $logfile 2>&1 19 59 20 file=$path/alldatabases 21 end=.sql.bz2 22 23 dbydfile=$file$dbyd$end 24 echo "removing old file..." >> $logfile 2>&1 25 26 rm -v $dbydfile >> $logfile 2>&1 27 28 echo "writing all databases to file..." >> $logfile 2>&1 60 echo "writing all databases to $zipfile..." >> $logfile 2>&1 29 61 set +C 30 mysqldump --host=vela --all-databases -u dump | bzip2 -9 -c > $file$datum$end 2>> $logfile 62 # complete databases 63 mysqldump --host=vela --all-databases -u dump | bzip2 -9 -c > $zipfile 2>> $logfile 64 echo "writing create commands to $command..." >> $logfile 2>&1 65 # commands to create MyMagic 66 mysqldump --host=vela --database $dbname -u dump --no-data > $command 2>> $logfile 31 67 32 68
Note:
See TracChangeset
for help on using the changeset viewer.