Chinaunix首页 | 论坛 | 博客
  • 博客访问: 83220
  • 博文数量: 29
  • 博客积分: 815
  • 博客等级: 军士长
  • 技术积分: 395
  • 用 户 组: 普通用户
  • 注册时间: 2010-06-01 12:42
文章分类

全部博文(29)

文章存档

2016年(4)

2012年(24)

2011年(1)

分类: LINUX

2012-03-08 14:15:28

shell脚本:利用shell功能编写出来的程序来实现目的功能
 
shell脚本的功能:
自动化管理、追踪和管理系统的重要工作、简单的入侵检测功能、联系命令单一化、简单的数据处理、
跨平台支持和缩短学习历程、可以用vi来直接编写等
 
shell含义
第一行:#!/bin/bash  声明shell名称,加载相关环境设置文件
第二个:程序内容的声明:以下是几个信息:内容与功能,版本信息,作者与联系方式,文件创建日期,历史记录等。(养成良好的习惯很重要)
第三个:主要环境变量的说明
第四个:主程序部分
第五格:告知执行结果
注意:sh脚本至少需由7**权限也就是执行的权限
 
后续  附一生产脚本(数据库同步:备份前一天)
#! /bin/sh
cd /home/oracle
source ./.bash_profile
rq=`date +%y%m%d`
scp /backup/newplat/
gunzip /backup/newplat/full$rq.dmp.gz
if (find /backup/newplat/ -name full$rq.dmp)
then
sqlplus " / as sysdba" <
        drop user newplat cascade;
        create user newplat identified by sumit2011 default tablespace TBS_NEWPLAT temporary tablespace temp;
        grant dba to newplat;
       
!EOF
imp newplat/sumit2011 buffer=181920000 file=/backup/newplat/full$rq.dmp fromuser=mps touser=newplat ignore=y
gzip /backup/newplat/full$rq.dmp

sqlplus " / as sysdba" <   grant select on newplat.transaction_payment to cy;
   grant select on newplat.users to zy;
   grant select on newplat.transaction_topup to zy;
   grant select on newplat.transaction_abstract to zy;
   grant select on newplat.transaction_abstract to zy;
   grant select on newplat.topup_transaction_log to zy;
   grant select on newplat.region to zhouyang;
   grant select on newplat.billpay_queryorder to zy;
   grant select on newplat.transaction_billpay to zy;
   grant select on newplat.onlinebank_pay_log to xh;
   grant select on newplat.mps_transaction_log to zy;
   grant select on newplat.today_mps_transaction_log to zy;
   grant select on newplat.payment_abstract to zy;
   grant select on newplat.payment_offlinebank to zy;
   grant select on newplat.topup_card to zy;
   grant select on newplat.SVA_TRANSFER_LOG to zy;
   grant select on newplat.transaction_payment to zy;
   grant select on newplat.uinicallpay_log to xh;
   grant select on newplat.sva_transfer_log to zy;
!EOF
else
curl -d 'desttermid=186******5' -d 'serviceid=SHGRP' -d 'operator=allnet788' -d 'msg=没有同步' 
ener
fi
exit
 
阅读(1798) | 评论(1) | 转发(3) |
给主人留下些什么吧!~~

linky5212012-03-09 14:40:40