Current time: 11-24-2024, 10:31 AM Hello There, Guest! (LoginRegister)


Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Бекап доменов...
Author Message
server801 Offline
Moderator
*****
Moderators

Posts: 349
Joined: Mar 2009
Reputation: 1
Post: #4
RE: Бекап доменов...
Code:
#!/bin/sh

mysqldump="/usr/local/bin/mysqldump"
mysqlparam="-u root -pпароль"
bzip2="/usr/bin/bzip2"

databases=`echo "show databases" | mysql ${mysqlparam} | grep -v "^D"`
dstdir="/home/backup_mysql"

fname=`date "+%Y-%m-%d`

# remove old
/usr/bin/find $dstdir -atime +8 -delete

# back it up
for dbs in $databases
do
$mysqldump $mysqlparam $dbs| $bzip2 -c -9 > ${dstdir}/${dbs}-${fname}.sql.bz2
done

Code:
/home/backup_mysql]# ll
total 4966
-rwxr-xr-x  1 root  wheel  -  407B Aug 31 01:02 dump.sh
-rw-r--r--  1 root  wheel  -  2.4M Oct 28 10:49 fifalive-2010-10-28.sql.bz2
-rw-r--r--  1 root  wheel  -  648K Oct 28 10:49 forum-2010-10-28.sql.bz2
-rw-r--r--  1 root  wheel  -  714K Oct 28 10:49 forum1-2010-10-28.sql.bz2
-rw-r--r--  1 root  wheel  -  484B Oct 28 10:49 information_schema-2010-10-28.sql.bz2
-rw-r--r--  1 root  wheel  -  565K Oct 28 10:49 mapkc-2010-10-28.sql.bz2
-rw-r--r--  1 root  wheel  -   80K Oct 28 10:49 mysql-2010-10-28.sql.bz2
это под фрю. под линух меняйте пути. в крон его и заебамба
(This post was last modified: 11-02-2010 12:04 AM by server801.)
11-02-2010 12:02 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply 


Messages In This Thread
Бекап доменов... - DragonZX - 11-01-2010, 05:57 AM
RE: Бекап доменов... - Diza - 11-01-2010, 02:01 PM
RE: Бекап доменов... - server801 - 11-02-2010 12:02 AM
RE: Бекап доменов... - flames - 11-12-2010, 05:02 PM

Forum Jump:


User(s) browsing this thread: 1 Guest(s)