SHARE
TWEET

Untitled

a guest May 19th, 2017 36 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/sh
  2. databases=()
  3.  
  4. backup_dir=/root/db_dump
  5.  
  6. if [ ! -d $backup_dir ]; then
  7.   mkdir -p $backup_dir
  8. fi
  9.  
  10. cd $backup_dir
  11.  
  12. for name in ${databases[@]}
  13. do
  14.   for j in 7 6 5 4 3 2 1 0; do
  15.     for i in $name.$j; do
  16.       if [ -e $i.sql.bz2 ]; then
  17.         mv $i.sql.bz2 ${i/.$j/}.$(( $j + 1 )).sql.bz2;
  18.       fi
  19.     done
  20.   done
  21.  
  22.   mysqldump -u user -pPASS $name > ./$name.0.sql
  23.   bzip2 -z $name.0.sql
  24. done
RAW Paste Data
Challenge yourself this year...
Learn something new in 2017
Top