#!/bin/bash
# FTP服务器信息
FTP_HOST='ftp地址'
FTP_USER='ftp用户名'
FTP_PASS='ftp密码'
FTP_DIR='/' # FTP服务器上的目标目录
BACKUP_DIR="/root/xxx/mysql/data"
LOCAL_FILE="$BACKUP_DIR/backup_crudwiki_$(date +%Y%m%d).sql.gz"
# 使用lftp进行文件上传
lftp <<EOF
open $FTP_HOST
user $FTP_USER $FTP_PASS
cd $FTP_DIR
put $LOCAL_FILE
bye
EOF
Was this helpful?
0 / 0