#!/bin/bash
database info
today=
(
d
a
t
e
−
d
"
n
o
w
"
+
a
g
o
30
=
(date -d "now" +%Y-%m-%d) ago30=
(date−d"now"+ago30=(date -d “-30 days” +%Y-%m-%d)
echo ${today}
echo
a
g
o
30
t
a
r
−
c
v
f
/
s
u
n
l
a
n
d
s
/
d
b
b
a
c
k
u
p
/
m
y
s
q
l
/
z
l
c
x
w
x
/
{ago30} tar -cvf /sunlands/db_backup/mysql/zlcx_wx/
ago30tar−cvf/sunlands/dbbackup/mysql/zlcxwx/{today}-172.16.117.19-DB-audit.tar /sunlands/db_backup/mysql/zlcx_wx/roi_manager-${today}-*.sql
cd /sunlands/db_backup/mysql/zlcx_wx/
ftp -ivn <<EOF
open 49.233.49.21
user name password
binary
put ${today}-172.16.117.19-DB-audit.tar
DELETE ${ago30}-172.16.117.19-DB-audit.tar
quit
EOF
rm -rf ${today}-172.16.117.19-DB-audit.tar