Subversion Repositories ALCASAR

Rev

Rev 2412 | Rev 2811 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 2412 Rev 2664
Line 1... Line 1...
1
#!/bin/bash
1
#!/bin/bash
2
# $Id: alcasar-mysql.sh 2412 2017-09-17 12:11:23Z tom.houdayer $
2
# $Id: alcasar-mysql.sh 2664 2018-11-19 17:35:12Z tom.houdayer $
3
 
3
 
4
# alcasar-mysql.sh
4
# alcasar-mysql.sh
5
# by Franck BOUIJOUX, Pascal LEVANT and Richard REY
5
# by Franck BOUIJOUX, Pascal LEVANT and Richard REY
6
# This script is distributed under the Gnu General Public License (GPL)
6
# This script is distributed under the Gnu General Public License (GPL)
7
 
7
 
8
# Gestion (sauvegarde / import / RAZ) de la base MySQL 'radius'. Fermeture des sessions de comptabilité ouvertes
8
# Gestion (sauvegarde / import / RAZ) de la base MySQL 'radius'. Fermeture des sessions de comptabilité ouvertes
9
# Management of mysql 'radius' database (save / import / RAZ). Close the accounting open sessions
9
# Management of mysql 'radius' database (save / import / RAZ). Close the accounting open sessions
10
 
10
 
11
rep_tr="/var/Save/base"				# répertoire d'accueil des sauvegardes
11
rep_tr="/var/Save/base"				# répertoire d'accueil des sauvegardes
-
 
12
DIR_BIN="/usr/local/bin"
12
PASSWD_FILE="/root/ALCASAR-passwords.txt"
13
PASSWD_FILE="/root/ALCASAR-passwords.txt"
13
DB_RADIUS="radius"
14
DB_RADIUS="radius"
14
DB_USER=$(grep '^db_user=' $PASSWD_FILE | cut -d'=' -f 2-)
15
DB_USER=$(grep '^db_user=' $PASSWD_FILE | cut -d'=' -f 2-)
15
DB_PASS=$(grep '^db_password=' $PASSWD_FILE | cut -d'=' -f 2-)
16
DB_PASS=$(grep '^db_password=' $PASSWD_FILE | cut -d'=' -f 2-)
16
new="$(date +%G%m%d-%Hh%M)"			# date et heure des fichiers
17
new="$(date +%G%m%d-%Hh%M)"			# date et heure des fichiers
Line 115... Line 116...
115
			*.sql )
116
			*.sql )
116
				mysql -u $DB_USER -p$DB_PASS < $2
117
				mysql -u $DB_USER -p$DB_PASS < $2
117
				stop_acct	
118
				stop_acct	
118
				;;
119
				;;
119
			esac
120
			esac
-
 
121
			migrationsPath="$DIR_BIN/alcasar-migrations"
-
 
122
			"$migrationsPath/alcasar-migration-3.2.0_dbStructure.sh"
-
 
123
			"$migrationsPath/alcasar-migration-3.3.0_dbRadiusAttrs.sh"
-
 
124
			"$migrationsPath/alcasar-migration-3.3.1_dbRadiusAttrs.sh"
120
		fi
125
		fi
121
		;;
126
		;;
122
	-r | --raz | -raz)
127
	-r | --raz | -raz)
123
		mysqldump -u $DB_USER -p$DB_PASS --opt -BcQC  $DB_RADIUS > $rep_tr/$fichier
128
		mysqldump -u $DB_USER -p$DB_PASS --opt -BcQC  $DB_RADIUS > $rep_tr/$fichier
124
		gzip -f $rep_tr/$fichier
129
		gzip -f $rep_tr/$fichier