I have different sheel script on my server :
- Some to do 'hard backup' of DB
blog.shnoulle.net/Un-ptit-script-de-backup-mysql
(in sql file)
- Some to copy DB in DB (with another name)
- Some tar backup of needed directory
Code:
#!/bin/bash
# Linux bin paths, change this if it can not be autodetected via which command
MYSQL="$(which mysql)"
MYSQLDUMP="$(which mysqldump)"
GZIP="$(which gzip)"
# Get hostname
HOST="$(hostname)"
# File to store current backup file
FILE=""
# Get all database list first , if you want to backup all DBS
# DBS="$($MYSQL -Bse 'show databases')"
# Store list of databases
DBS="limesurvey
limesurvey2
cms1
"
# Get all database list first
#DBS="$($MYSQL -Bse 'show databases')"
echo "Backup of DBs"
for db in $DBS
do
dbnew="zzbak_last_$db"
$MYSQLDUMP --databases $db > $HOME/backupsql/$db.sql
echo "DROP DATABASE IF EXISTS ${dbnew}" | $MYSQL
echo "CREATE DATABASE ${dbnew}" | $MYSQL
$MYSQL $dbnew < $HOME/backupsql/$db.sql
done
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member. -
Professional support
-
Plugins, theme and development
. I don't answer to private message.