This article address: http://blog.csdn.net/useway JavaProgramClerk, what's going on at work
First, it is a shell script program, which is very simple for your reference: Date = 'date + % F _ % H'
Filename = "/home/bak/databackup/netmanage _" $ date ".tar.gz"
Savefilename = "/home/bak/databackup/filebackup/netmanage _" $ date "_"
Sudo tar-zcvf $ filename/var/lib/MySQL/netmanage/
Split-B 500 M $ filename $ savefilename
Rm-RF $ filename
The second is a python: #! /Usr/bin/ENV pythonimport sys, OS, time mysql_usr = 'root' MySQL _ Pwd = '000000' MySQL _ DB = 'mysql' MySQL _ charset = 'gb2312 'cmd _ Path ='/usr/bin/'# command path today of mysqldump = bk_path + time. strftime ('% Y-% m-% D ')
Fname = Today + OS. SEP + time. strftime ('% H % m % s') + '.gz' OS. mkdir (today) Export _dump = "% smysqldump-U % s-p % s -- default-character-set = % s -- opt % S | gzip> % s" %/
(Pai_path, mysql_usr, mysql_pwd, mysql_charset, mysql_db, fname)
OS. System (pai_dump)
Address: http://blog.csdn.net/useway