/[pdpsoft]/trunk/eu.rcauth.pilot-ica/DS/ansible/roles/delegserver/files/mysql-dump.sh
ViewVC logotype

Contents of /trunk/eu.rcauth.pilot-ica/DS/ansible/roles/delegserver/files/mysql-dump.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3077 - (show annotations) (download) (as text)
Mon Aug 8 13:37:02 2016 UTC (5 years, 5 months ago) by msalle
File MIME type: application/x-shellscript
File size: 788 byte(s)
Add mysql dump and restore scripts plus cronjob for the former.
Move 00-httpoxy from templates to file (it's not a template)
Update the oauth2 war and jar files.

1 #! /bin/sh
2 #
3 DIR="${DIR:-/var/preserve/dbbackup/MySQL}"
4 DATEMARK=`date '+%Y-%V-%A-%H%M'|tr A-Z a-z`
5 UTCTIME=`date -u '+%Y%m%d%H%M%SZ'`
6 DATEINFO=`date '+%Y-%m-%d %H:%M:%S %Z %z (%A, week %V)'`
7
8 . /etc/mysql
9
10 mkdir -p "$DIR"
11
12 MYSQL="mysql -u root --password="$PW""
13 MYSQLDUMP="mysqldump -u root --password="$PW" --single-transaction -q"
14
15 databases=`echo "show databases" | $MYSQL | egrep -v '^(Database|test)'`
16
17 for db in $databases
18 do
19 ARCH="$DIR/db.$db.$DATEMARK.sql"
20 (
21 echo "-- Backup of database $db" ;
22 echo "-- Dumped on $UTCTIME" ;
23 echo "-- Compression: directly-compressed" ;
24 echo "-- Dateinfo: $DATEINFO" ;
25 $MYSQLDUMP --databases $db ) | gzip -c > ${ARCH}.gz
26 done
27
28 # verwijder dumpfiles ouder dan 10 dagen
29 find "$DIR" -mtime +10 -type f -name \*.sql.gz -exec rm {} \;
30
31

Properties

Name Value
svn:executable *

grid.support@nikhef.nl
ViewVC Help
Powered by ViewVC 1.1.28