Chinaunix首页 | 论坛 | 博客
  • 博客访问: 619448
  • 博文数量: 75
  • 博客积分: 988
  • 博客等级: 准尉
  • 技术积分: 1269
  • 用 户 组: 普通用户
  • 注册时间: 2011-05-10 15:44
文章分类

全部博文(75)

文章存档

2022年(1)

2019年(1)

2018年(1)

2016年(9)

2015年(7)

2013年(6)

2012年(40)

2011年(10)

分类:

2012-03-12 11:07:49

原文地址:linux学习--shell脚本 作者:wau213

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
 
阅读(1029) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~