Linux定时的FTP上传任务
Linux  /  houtizong 发布于 3年前   142
backup_Ymd=`date +%Y-%m-%d`echo "start time" $backup_YmdftpServer=xxxxxxxxxxx(外网的域名)ftpUser=username(FTP用户名)ftpPasswd=password(FTP密码)remoteDir=/mysql_log(FTP上存放目录)localDir=/home/mysql/logs(本地目录)/usr/kerberos/bin/ftp -niv <<!open $ftpServer [port]user $ftpUser $ftpPasswdbinarycd $remoteDirlcd $localDirmput *.zipbye!
start time 2013-08-1410Connected to xxxxxxxxxxx.220 Serv-U FTP Server v6.4 for WinSock ready...500 'AUTH': command not understood.500 'AUTH': command not understood.KERBEROS_V4 rejected as an authentication typeRemote system type is UNIX.Using binary mode to transfer files.331 User name okay, need password.230 User logged in, proceed.200 Type set to I.250 Directory changed to /mysql_logLocal directory now /home/mysql/logslocal: 2013-08-1007.zip remote: 2013-08-1007.zip227 Entering Passive Mode (117,29,170,154,21,191)ftp: connect: Connection timed out221 Goodbye!
#/bin/bashbackup_Ymd=`date +%Y-%m-%d`echo "start time" $backup_YmdftpServer=XXXXXXXXXftpUser=usernameftpPasswd=passwordremoteDir=/mysql_loglocalDir=/home/mysql/logs/usr/kerberos/bin/ftp -niv <<!open $ftpServer 29user $ftpUser $ftpPasswdpassive #关闭被动模式binarycd $remoteDirlcd $localDirmput $backup_Ymd.zipbye!
[root@localhost ~]# ftp XXXXXXXXXConnected to XXXXXXXXXX.220 Serv-U FTP Server v6.4 for WinSock ready...500 'AUTH': command not understood.500 'AUTH': command not understood.KERBEROS_V4 rejected as an authentication typeName (center.gouyundong.net:root): username 331 User name okay, need password.Password:230 User logged in, proceed.Remote system type is UNIX.Using binary mode to transfer files.ftp> ls227 Entering Passive Mode (117,29,170,154,37,249)ftp> passivePassive mode off.ftp> ls200 PORT Command successful.
man crontab或者
crontalb --help
crontab -e30 7 * * * /usr/local/sbin/dblogsftp.sh:wq设置为每天的7点30分执行
请勿发布不友善或者负能量的内容。与人为善,比聪明更重要!
技术博客集 - 网站简介:
前后端技术:
后端基于Hyperf2.1框架开发,前端使用Bootstrap可视化布局系统生成
网站主要作用:
1.编程技术分享及讨论交流,内置聊天系统;
2.测试交流框架问题,比如:Hyperf、Laravel、TP、beego;
3.本站数据是基于大数据采集等爬虫技术为基础助力分享知识,如有侵权请发邮件到站长邮箱,站长会尽快处理;
4.站长邮箱:[email protected];
文章归档
文章标签
友情链接