Changeset 11842 for trunk/Mars
- Timestamp:
- 08/08/11 10:46:05 (13 years ago)
- Location:
- trunk/Mars/datacenter/scripts
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Mars/datacenter/scripts/budb
r9291 r11842 18 18 # 19 19 # 20 # Author(s): Daniela Dorner 10/2006 <mailto:d orner@astro.uni-wuerzburg.de>20 # Author(s): Daniela Dorner 10/2006 <mailto:daniela.dorner@unige.ch> 21 21 # 22 # Copyright: MAGIC Software Development, 2000-20 0822 # Copyright: MAGIC Software Development, 2000-2011 23 23 # 24 24 # 25 25 # ======================================================================== 26 26 # 27 # This script backups the Magic Database. 28 # In addition it writes out the commands how to create the database. 27 # This script backups the databases give in setup.XXX in the array dbnames 28 # 29 # In addition, it writes out the commands how to create the database 30 # MyMagic, in case all databases are backuped. 29 31 # 30 32 … … 37 39 set -C 38 40 39 path=/home/`whoami`/ budb41 path=/home/`whoami`/DB_Backup 40 42 logpath=$path/log 43 filepath=$path/files 41 44 mkdir -pv $logpath 45 mkdir -pv $filepath 42 46 logfile=$logpath/budb$today.log 43 47 oldlog=$logpath/budb$olday.log 44 file=$path/alldatabases45 end=.sql.bz246 zipfile=$file$today$end47 oldzip=$file$olday$end48 49 dbname=MyMagic50 command=$path/Create$dbname$today.txt51 oldcommand=$path/Create$dbname$olday.txt52 48 53 49 date > $logfile … … 57 53 echo "date to remove: $olday" >> $logfile 2>&1 58 54 59 echo "removing old files..." >> $logfile 2>&1 60 rm -v $oldzip >> $logfile 2>&1 61 rm -v $oldlog >> $logfile 2>&1 62 rm -v $oldcommand >> $logfile 2>&1 55 if ls $oldlog >/dev/null 2>&1 56 then 57 echo "removing old logfile..." >> $logfile 2>&1 58 rm -v $oldlog >> $logfile 2>&1 59 fi 63 60 64 echo "writing all databases to $zipfile..." >> $logfile 2>&1 61 if [ "${dbnames[0]}" == "all" ] 62 then 63 dbname=MyMagic 64 command=$filepath/Create$dbname$today.txt 65 oldcommand=$filepath/Create$dbname$olday.txt 66 file=$filepath/alldatabases 67 end=.sql.bz2 68 zipfile=$file$today$end 69 oldzip=$file$olday$end 65 70 66 # complete databases 67 if ! mysqldump --host=$ho --all-databases -u dump | bzip2 -9 -c >| $zipfile 2>> $logfile 68 then 69 printprocesslog "ERROR mysqldump failed " 70 echo "ERROR mysqldump failed " >> $logfile 2>&1 71 fi 72 echo "writing create commands to $command..." >> $logfile 2>&1 73 # commands to create MyMagic 74 if ! mysqldump --host=$ho --database $dbname -u dump --no-data >| $command 2>> $logfile 75 then 76 printprocesslog "ERROR mysqldump failed " 77 echo "ERROR mysqldump failed " >> $logfile 2>&1 71 echo "removing old files..." >> $logfile 2>&1 72 if ls $oldzip >/dev/null 2>&1 73 then 74 rm -v $oldzip >> $logfile 2>&1 75 fi 76 if ls $oldcommand >/dev/null 2>&1 77 then 78 rm -v $oldcommand >> $logfile 2>&1 79 fi 80 81 echo "writing create commands to $command..." >> $logfile 2>&1 82 # commands to create MyMagic 83 if ! mysqldump --host=$ho --database $dbname -u dump --no-data >| $command 2>> $logfile 84 then 85 printprocesslog "ERROR mysqldump failed " 86 echo "ERROR mysqldump failed " >> $logfile 2>&1 87 fi 88 89 echo "writing all databases to $zipfile..." >> $logfile 2>&1 90 # complete databases 91 if ! mysqldump --host=$ho --all-databases -u dump | bzip2 -9 -c >| $zipfile 2>> $logfile 92 then 93 printprocesslog "ERROR mysqldump failed " 94 echo "ERROR mysqldump failed " >> $logfile 2>&1 95 fi 96 else 97 echo "doing backup for the following databases: "${dbnames[@]} >> $logfile 2>&1 98 for dbname in ${dbnames[@]} 99 do 100 filepath2=$filepath/$dbname 101 command=$filepath2"/Create_"$dbname"_"$today".txt" 102 oldcommand=$filepath2"/Create_"$dbname"_"$olday".txt" 103 mkdir -pv $filepath2 104 105 file=$filepath2/$dbname 106 end=.sql.bz2 107 zipfile=$file"_"$today$end 108 oldzip=$file"_"$olday$end 109 110 echo "removing old files..." >> $logfile 2>&1 111 if ls $oldzip >/dev/null 2>&1 112 then 113 rm -v $oldzip >> $logfile 2>&1 114 fi 115 if ls $oldlog >/dev/null 2>&1 116 then 117 rm -v $oldlog >> $logfile 2>&1 118 fi 119 if ls $oldcommand >/dev/null 2>&1 120 then 121 rm -v $oldcommand >> $logfile 2>&1 122 fi 123 124 echo "writing create commands to $command..." >> $logfile 2>&1 125 # commands to create db 126 if ! mysqldump --host=$ho --database $dbname -u dump --no-data >| $command 2>> $logfile 127 then 128 printprocesslog "ERROR mysqldump failed " 129 echo "ERROR mysqldump failed " >> $logfile 2>&1 130 fi 131 132 echo "writing database $dbname to $zipfile..." >> $logfile 2>&1 133 134 if ! mysqldump --host=$ho --database $dbname -u dump | bzip2 -9 -c >| $zipfile 2>> $logfile 135 then 136 printprocesslog "ERROR mysqldump failed " 137 echo "ERROR mysqldump failed " >> $logfile 2>&1 138 fi 139 done 78 140 fi 79 141 -
trunk/Mars/datacenter/scripts/setup.wue.fact.mc
r10039 r11842 41 41 sitekey=1 42 42 storagesite=wue 43 44 # for db backup 45 dbnames=( "TestFACTSetup" ) 43 46 44 47 # queuing system -
trunk/Mars/datacenter/scripts/setup.wue.magic.data
r9604 r11842 40 40 queuesys=condor # wuerzburg data center 41 41 condorpath=/usr/local/bin 42 43 # for db backup 44 dbnames=( "all" ) 42 45 43 46 # logging and setup
Note:
See TracChangeset
for help on using the changeset viewer.