编写shell脚本unload表格里的内容到指定文件里
2016-03-16 11:59
453 查看
$HOME/.profile
//这里是不赋值环境变量,直接引用.profile文件。
Today=`date +%Y%m%d`
//这里是给当天日期变量赋值
gjfile=khtgjmx.$Today.210000.0000.dat
khfile=khtqykh.$Today.210000.0000.dat
dbaccess gafeywk<<!
//选定数据库
unload to $gjfile select b.xybh,a.ywrq,a.cgje from yltyw_plmxb a ,yltyw_gjxyb b where a.zt='0' and a.shzt='0' and a.ywrq='$Today' and a.zcyhdm=b.gjyhdm and a.zczh=b.gjyhzh and a.zrzh=b.qyzh ;
//数据库操作语句,意思是把表格里的内容下载到gjfile文件里。
unload to $khfile select zjhm,bljg,xybh,qyzh,zhhm,blrq,gjzqlx,zjlx from yltyw_gjxyb where zt='0';
!
//关闭数据库
gzip -f $gjfile;
gzip -f $khfile;
//压缩文件
echo "正在发送备份文件..."
echo "user gafe gafe" >ftp.tmp
echo "bin" >>ftp.tmp
echo "cd /gafe/ftpdata" >>ftp.tmp
echo "put $gjwjm.gz" >>ftp.tmp
echo "put $khwjm.gz" >>ftp.tmp
echo "bye" >>ftp.tmp
ftp -i -n 168.31.63.233 <ftp.tmp
echo "Finished!"
//使用ftpdata把文件发送到java同事要取文件的服务器上。
[/code]
相关文章推荐
- Shell脚本编程学习笔记
- shell 除法 小数点
- Shell脚本编程学习笔记
- 编写shell脚本unload表格里的内容到指定文件里
- shell 生成指定范围随机数与随机字符串
- shell rm 重命名 删除文件或文件夹
- shell【LANMP一建安装】
- shell函数|常用命令|重定向
- shell流程控制
- bash alias 终极使用方法
- shell命令集
- adb shell后出现error解决方案
- adb shell后出现error解决方案
- shell运算符
- [shell]管理 Sphinx 启动|停止|重新生成索引的脚本
- shell
- 一个简单的遍历选定目录的PowerShell脚本
- shell脚本编程基础(1)及RAID阵列
- shell空数组
- shell二维数组