Tags: scp

Sort by: Date / Title /

  1. 8 years ago by jeanmirroir
    1. scp </file to copy/files.myext> user@<remote_IP>:/<path_to_past>
    Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/1790"></script>
  2. 10 years ago by neorom and saved by 2 others
    3ème version plus complète des backups
    1. #!/bin/bash
    2.  
    3. TAR_COMPRESS="tar cjvf" # Commande de compression
    4. BACKUP_EXTENSION="tar.bz2" # Extension des fichiers compressés
    5. DATE=`date '+%d-%m-%Y'`
    6. BACKUP_ADDRESS="sav@server.org"
    7. BACKUP_DIR="/directory"
    8.  
    9.  
    10.  
    11. echo "Sauvegarde des fichiers"
    12.  
    13. echo "On sauvegarde et on envoie le home"
    14. cd /home
    15. for i in `ls`
    16. do
    17.                 $TAR_COMPRESS $i-$DATE.$BACKUP_EXTENSION /home/$i/*
    18.                 echo "`date` debut scp $i" >> /var/log/backup.log
    19.                 scp $i-$DATE.$BACKUP_EXTENSION $BACKUP_ADDRESS:$BACKUP_DIR
    20.                 echo "`date` fin scp $i" >> /var/log/backup.log
    21.                 rm -f $i-$DATE.$BACKUP_EXTENSION
    22. done
    23.  
    24. echo "On sauvegarde et on envoie le home du root "
    25. $TAR_COMPRESS root-$DATE.$BACKUP_EXTENSION /root/
    26. echo "`date` debut scp /root" >> /var/log/backup.log
    27. scp root-$DATE.$BACKUP_EXTENSION $BACKUP_ADDRESS:$BACKUP_DIR
    28. echo "`date` fin scp /root" >> /var/log/backup.log
    29. rm -f root-$DATE.$BACKUP_EXTENSION
    30. echo "On sauvegarde et on envoie le etc"
    31. $TAR_COMPRESS etc-$DATE.$BACKUP_EXTENSION /etc/
    32. echo "`date` debut scp /etc" >> /var/log/backup.log
    33. scp etc-$DATE.$BACKUP_EXTENSION $BACKUP_ADDRESS:$BACKUP_DIR
    34. echo "`date` fin scp /etc" >> /var/log/backup.log
    35. rm -f etc-$DATE.$BACKUP_EXTENSION
    36.  
    37. echo "On passe au dump MySQL"
    38. MYSQL_USER="root" # User mySQL à utiliser pour faire le dump
    39. MYSQL_PASSWORD="pass" # Mot de passe root de la base mySQL
    40. MYSQL_HOST="localhost" # Host de la base mySQL
    41. SQL_LIST_DB="SHOW DATABASES;" # Requete SQL listant toutes les bases
    42.  
    43. cd /home/backup/dumpsql
    44. echo "Dump de toutes les bases MySQL"
    45. mysqldump -p"$MYSQL_PASSWORD" --all-databases > all-databases.$DATE.sql
    46.  
    47. echo "Compression et envoie du dump"
    48. $TAR_COMPRESS  all-databases-$DATE.sql.$BACKUP_EXTENSION all-databases.$DATE.sql
    49. echo "`date` debut scp all databases" >> /var/log/backup.log
    50. scp all-databases-$DATE.sql.$BACKUP_EXTENSION $BACKUP_ADDRESS:$BACKUP_DIR
    51. echo "`date` fin scp all databases" >> /var/log/backup.log
    52. rm -f all-databases.$DATE.sql
    53. rm -f all-databases-$DATE.sql.$BACKUP_EXTENSION
    54.  
    55. echo "Dump base par base"
    56. for database in `echo $SQL_LIST_DB | mysql -u $MYSQL_USER -p"$MYSQL_PASSWORD" -h $MYSQL_HOST | sed 1d`
    57. do
    58.  
    59.         mysqldump -p"$MYSQL_PASSWORD" --databases $database > $database-$DATE.sql
    60.  
    61.         $TAR_COMPRESS $database-$DATE.sql.$BACKUP_EXTENSION $database-$DATE.sql
    62.         rm -f $database-$DATE.sql
    63. done
    64.  
    65. echo "On sauvegarde le dump des bases et on l'envoie"
    66. $TAR_COMPRESS dump-$DATE.$BACKUP_EXTENSION *.*.sql.$BACKUP_EXTENSION
    67. echo "`date` debut scp base par base" >> /var/log/backup.log
    68. scp dump-$DATE.$BACKUP_EXTENSION $BACKUP_ADDRESS:$BACKUP_DIR
    69. echo "`date` fin scp base par base" >> /var/log/backup.log
    70. rm -f dump-$DATE.$BACKUP_EXTENSION
    Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/13"></script>

First / Previous / Next / Last / Page 1 of 1 (2 posteets)