Advertisement
Guest User

Untitled

a guest
Apr 27th, 2013
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.60 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. user="root";
  4. password="xxx";
  5.  
  6.  
  7. #Sprawdzamy czy macierz sie pinga
  8. ping 10.10.0.100 -c 5
  9.  
  10. if [ "$?" != 0 ]; then
  11. exit 2;
  12. else
  13. #Probujemy zamontowac
  14. mount -vvvv 10.10.0.100:/mnt/storage/back-mysql /mnt/mysql-backup/ -o nolock
  15.  
  16. #Jesli sie nie udalo, konczymy.
  17. if [ "$?" != "0" ]; then
  18.  
  19. exit 2;
  20.  
  21. fi
  22.  
  23. date1=`date +%F`
  24. mkdir /mnt/mysql-backup/$date1
  25.  
  26. date=`date +"%F-%H-%M"`
  27. echo -n "Backup lms...."
  28. mysqldump -u${user} -p${password} lms > /mnt/mysql-backup/$date1/lms.sql.$date
  29. echo -en "\y [ DONE ]";
  30. echo
  31.  
  32.  
  33. gzip -9 -r /mnt/mysql-backup/*
  34. umount /mnt/mysql-backup/
  35. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement