Advertisement
Guest User

Untitled

a guest
Jul 6th, 2017
484
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.01 KB | None | 0 0
  1. if [ "$MYSQLOPT" = 1 ]; then #MySQL section
  2. echo "$($TIME) - Backing MySQL on $MYSQLSRV" | tee -a $LOG
  3. if [ ! -d $BKUPDIR/$MYSQLSRV/MySQL ];then
  4. mkdir -p $BKUPDIR/$MYSQLSRV/MySQL || printerr 'ERROR - $LINENO - Unable to create backup directory for $MYSQLSRV in $BKUPDIR.' #2>> $LOG
  5. fi
  6. if ssh $SSHUSER@$MYSQLSRV : 1>> $LOG 2>> $LOG;then
  7. ssh $SSHUSER@$MYSQLSRV "echo 'show databases\g' | mysql --user='guy' --password='pass' | awk '{if (NR!=1) {print}}'" | (while read -r EACHDBNAME;do
  8. echo "Working on $EACHDBNAME"
  9. ssh $SSHUSER@$MYSQLSRV "mysqldump --user='guy' --password='pass' $EACHDBNAME | gzip" 1> $BKUPDIR/$MYSQLSRV/MySQL/$EACHDBNAME.sql.gz #|| printerr 'ERROR - $LINENO - Unable to back up MySQL database $EACHDBNAME on $MYSQLSRV.' #2>> $LOG
  10. done)
  11. else
  12. printerr "ERROR - $LINENO - SSH to $MYSQLSRV failed." 1>> $LOG 2>> $LOG
  13. fi
  14. fi
  15.  
  16. [guy@place ~]$ /usr/local/bin/Backup.sh -m
  17. Successfully acquired lock: /tmp/Backup.sh.lock
  18. 12-18-2010 - 04:25:48 PM - Starting run of Backup.sh. Additional details at the end of the log.
  19. 04:25:48 PM - Environment is sane, starting backup.
  20. 04:25:48 PM - Backing MySQL on 2.2.2.2
  21. Working on information_schema
  22. Working on delta2
  23. Working on history
  24. Working on info_cast
  25. Working on mysql
  26. Working on test
  27. Working on unit_delta
  28. 04:25:50 PM - Cleaning up
  29. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  30. Server: place
  31. Script name: Backup.sh
  32. Script location: /usr/local/bin
  33. Log: /var/log/backup/2010-12-18-Backup.sh.log
  34. MySQL option enabled on 67.210.228.150 for the database MYSQLDB.
  35. Start: 12-18-2010 - 04:25:48 PM
  36. End: 12-18-2010 - 04:25:50 PM
  37. Duration: 0 days, 0 hours, 0 minutes, 2 seconds
  38.  
  39. Completed successfully!
  40. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  41.  
  42.  
  43.  
  44.  
  45. [guy@Wplace ~]$ /usr/local/bin/Backup.sh -m
  46. Successfully acquired lock: /tmp/Backup.sh.lock
  47. 12-18-2010 - 04:27:07 PM - Starting run of Backup.sh. Additional details at the end of the log.
  48. 04:27:07 PM - Environment is sane, starting backup.
  49. 04:27:07 PM - Backing MySQL on 2.2.2.2
  50. Working on information_schema
  51. 04:27:10 PM - Cleaning up
  52. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  53. Server: place
  54. Script name: Backup.sh
  55. Script location: /usr/local/bin
  56. Log: /var/log/backup/2010-12-18-Backup.sh.log
  57. MySQL option enabled on 67.210.228.150 for the database MYSQLDB.
  58. Start: 12-18-2010 - 04:27:07 PM
  59. End: 12-18-2010 - 04:27:10 PM
  60. Duration: 0 days, 0 hours, 0 minutes, 3 seconds
  61.  
  62. Completed successfully!
  63. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  64.  
  65.  
  66.  
  67.  
  68. 04:28:22 PM - Backing MySQL on 67.210.228.150
  69. + '[' '!' -d /backup/67.210.228.150/MySQL ']'
  70. + ssh backupuser@67.210.228.150 :
  71. + ssh backupuser@67.210.228.150 'echo '\''show databases\g'\'' | mysql --user='\''guy'\'' --password='\''pass'\'' | awk '\''{if (NR!=1) {print}}'\'''
  72. + read -r EACHDBNAME
  73. + echo 'Working on information_schema'
  74. Working on information_schema
  75. + ssh backupuser@67.210.228.150 'mysqldump --user='\''guy'\'' --password='\''pass'\'' information_schema | gzip'
  76. + read -r EACHDBNAME
  77. ++ date +%r
  78. + tee -a /var/log/backup/2010-12-18-Backup.sh.log
  79. + echo '04:28:25 PM - Cleaning up'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement