[ Index ] |
PHP Cross Reference of Unnamed Project |
[Summary view] [Print] [Text view]
1 #!/bin/sh -f 2 3 # MYSQL 4 . /root/.my.cnf 2&>/dev/null 5 6 mysql_all_save=$(/usr/bin/mysql --skip-column-names -s -h localhost -u root -p$password se3db -e "select value from params where name='mysql_all_save';") 7 8 if [ "$mysql_all_save" == "on" ]; then 9 # List les bases sur le serveur source 10 /usr/bin/mysql -h localhost -u root -p$password -e "show databases" | grep -v Database > /var/se3/save/bases 11 if [ ! -d /var/se3/save/mysql ]; then 12 mkdir -p /var/se3/save/mysql 13 fi 14 sleep 5 15 cat /var/se3/save/bases | while read A 16 do 17 if [ "$A" != "mysql" -a "$A" != "se3db" ] 18 then 19 /usr/bin/mysqldump -cQ --opt --add-drop-table -h localhost -u root -p$password -B $A > /var/se3/save/mysql/$A.sql 20 fi 21 done 22 fi 23 24 if [ -e /var/www/se3/includes/config.inc.php ]; then 25 dbhost=`cat /var/www/se3/includes/config.inc.php | grep "dbhost=" | cut -d = -f 2 |cut -d '"' -f 2` 26 dbname=`cat /var/www/se3/includes/config.inc.php | grep "dbname=" | cut -d = -f 2 |cut -d '"' -f 2` 27 dbuser=`cat /var/www/se3/includes/config.inc.php | grep "dbuser=" | cut -d = -f 2 |cut -d '"' -f 2` 28 dbpass=`cat /var/www/se3/includes/config.inc.php | grep "dbpass=" | cut -d = -f 2 |cut -d '"' -f 2` 29 else 30 echo "impossible d acceder aux params mysql" 31 exit 1 32 fi 33 34 NAS_mntsuffix=`mysql se3db -u $dbuser -p$dbpass -B -N -e "select value from params where name='NAS_mntsuffix'"` 35 if [ "$NAS_mntsuffix" = "pc" ]; then 36 repsauve="/var/lib/backuppc/pc" 37 else 38 repsauve="/var/lib/backuppc" 39 fi 40 41 [ -h $repsauve ] && repsauve=`readlink $repsauve` 42 for i in $(mount | tr " " "@"); do 43 pt_mnt=$(echo $i | cut -d "@" -f3) 44 if [ $pt_mnt == $repsauve ]; then 45 TESTMNT="ok" 46 fi 47 done 48 49 if [ "$TESTMNT" == "ok" ]; then 50 exec /bin/tar -c "$@" 51 else 52 echo "Erreur, aucune ressource montée sur $repsauve, la sauvegarde backuppc a échouée. Vérifiez votre unité de sauvegarde !!" | 53 mail -s "[SE3] : problème avec la sauvegarde backuppc" root 54 exit 1 55 fi 56
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Tue Mar 17 22:47:18 2015 | Cross-referenced by PHPXref 0.7.1 |