source: trunk/MagicSoft/Mars/datacenter/scripts/budb@ 9081

Last change on this file since 9081 was 9063, checked in by Daniela Dorner, 16 years ago
*** empty log message ***
  • Property svn:executable set to *
File size: 2.0 KB
Line 
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#
30
31today=`date +%F`
32olday=`date +%F --date="-30day"`
33
34set -C
35
36path=/home/`whoami`/budb
37logpath=$path/log
38mkdir -pv $logpath
39logfile=$logpath/budb$today.log
40oldlog=$logpath/budb$olday.log
41file=$path/alldatabases
42end=.sql.bz2
43zipfile=$file$today$end
44oldzip=$file$olday$end
45
46dbname=MyMagic
47command=$path/Create$dbname$today.txt
48oldcommand=$path/Create$dbname$olday.txt
49
50date > $logfile
51
52echo "today: $today" >> $logfile 2>&1
53echo "date to remove: $olday" >> $logfile 2>&1
54
55echo "removing old files..." >> $logfile 2>&1
56rm -v $oldzip >> $logfile 2>&1
57rm -v $oldlog >> $logfile 2>&1
58rm -v $oldcommand >> $logfile 2>&1
59
60echo "writing all databases to $zipfile..." >> $logfile 2>&1
61set +C
62# complete databases
63mysqldump --host=vela --all-databases -u dump | bzip2 -9 -c > $zipfile 2>> $logfile
64echo "writing create commands to $command..." >> $logfile 2>&1
65# commands to create MyMagic
66mysqldump --host=vela --database $dbname -u dump --no-data > $command 2>> $logfile
67
68
Note: See TracBrowser for help on using the repository browser.