• shell编程~学习笔记


    shell编程,涉及文件的修改,sql文件的执行,表空间和用户的创建

    #!/bin/sh
    #tabase initialized

    cd
    mkdir orcldata
    cd -
    echo "Hello, Please create your ODS user and password!"
    echo "Enter your ODS user:"
    read odsuser
    echo "Enter your ODS password:"
    read odspassword
    echo "You created odsUser:${odsuser},odsPassword:${odspassword}"
    chmod +x *
    find -name 'ods.sql'|xargs perl -pi -e 's|xiaoming|'${odsuser}'|g'
    find -name 'ods.sql'|xargs perl -pi -e 's|888888|'${odspassword}'|g'
    export ORACLE_SID=ods
    sqlplus sys/sys as sysdba <<EOF
    @ods.sql
    EOF
    echo "Database initialization completed"

     脚本ods.sql

    CREATE TABLESPACE ODSMES DATAFILE '/home/oracle/orcldata/odsmes.dbf' SIZE 50M AUTOEXTEND ON NEXT 50M MAXSIZE UNLIMITED;
    CREATE TEMPORARY TABLESPACE ODSMES_TEMP TEMPFILE '/home/oracle/orcldata/odsmes_temp.dbf' SIZE 50M AUTOEXTEND ON NEXT 50M MAXSIZE 5G;
    create user xiaoming identified by "888888" DEFAULT TABLESPACE ODSMES TEMPORARY TABLESPACE ODSMES_TEMP;
    GRANT dba TO xiaoming;
    GRANT CONNECT TO xiaoming;
    GRANT RESOURCE TO xiaoming;
    GRANT CREATE VIEW TO xiaoming;
    GRANT CREATE TABLE TO xiaoming;
    GRANT create sequence TO xiaoming;
    GRANT UNLIMITED TABLESPACE TO xiaoming;
    exit;

    shell执行Tomcat初始化

    #!/bin/sh
    #Application server Start
    # time:2017-02-16
    echo "Hello, about to start the server and the initial interface!"
    echo "Before you start the server, configure the database connection!"
    echo "Enter your ODS user?"
    read odsuser
    echo "Enter your ODS password?"
    read odspassword
    echo "Enter ODS url?"
    read odsurl
    echo "Enter your ODS InstanceName?"
    read oInstanceName
    echo "Enter your ODS PortNumber?"
    read oPortNumber
    echo "Enter your WIP user?"
    read wipuser
    echo "Enter your WIP password?"
    read wippassword
    echo "Enter your WIP url?"
    read wipurl
    echo "Enter your WIP InstanceName?"
    read wInstanceName
    echo "Enter your WIP PortNumber?"
    read wPortNumber
    echo "You entered odsUser:${odsuser},odsPassword:${odspassword},odsUrl:${odsurl},odsInstanceName:${oInstanceName},odsPortNumber:${oPortNumber}"
    echo "You entered wipUser:${wipuser},wipPassword:${wippassword},wipUrl:${wipurl},wipInstanceName:${wInstanceName},wipPortNumber:${wPortNumber}"
    echo "If correct, please enter: y; Otherwise, the input: n"
    read input
    enter1="y"
    enter2="n"
    while [ ${input} == ${enter2} ]
    do
    echo "Enter your ODS user?"
    read odsuser
    echo "Enter your ODS password?"
    read odspassword
    echo "Enter ODS url?"
    read odsurl
    echo "Enter your ODS InstanceName?"
    read oInstanceName
    echo "Enter your ODS PortNumber?"
    read oPortNumber
    echo "Enter your WIP user?"
    read wipuser
    echo "Enter your WIP password?"
    read wippassword
    echo "Enter your WIP url?"
    read wipurl
    echo "Enter your WIP InstanceName?"
    read wInstanceName
    echo "Enter your WIP PortNumber?"
    read wPortNumber
    echo "You entered odsUser:${odsuser},odsPassword:${odspassword},odsUrl:${odsurl},odsInstanceName:${oInstanceName},odsPortNumber:${oPortNumber}"
    echo "You entered wipUser:${wipuser},wipPassword:${wippassword},wipUrl:${wipurl},wipInstanceName:${wInstanceName},wipPortNumber:${wPortNumber}"
    echo "If correct, please enter: y; Otherwise, the input: n"
    read input
    done
    find -name 'jdbc@ifactory.properties'|xargs perl -pi -e 's|192.168.2.101|'${odsurl}'|g'
    find -name 'jdbc@ifactory.properties'|xargs perl -pi -e 's|1111|'${oPortNumber}'|g'
    find -name 'jdbc@ifactory.properties'|xargs perl -pi -e 's|orcl1|'${oInstanceName}'|g'
    find -name 'jdbc@ifactory.properties'|xargs perl -pi -e 's|odsUser|'${odsuser}'|g'
    find -name 'jdbc@ifactory.properties'|xargs perl -pi -e 's|7777777|'${odspassword}'|g'
    find -name 'jdbc@ifactory.properties'|xargs perl -pi -e 's|192.168.2.102|'${wipurl}'|g'
    find -name 'jdbc@ifactory.properties'|xargs perl -pi -e 's|2222|'${wPortNumber}'|g'
    find -name 'jdbc@ifactory.properties'|xargs perl -pi -e 's|orcl2|'${wInstanceName}'|g'
    find -name 'jdbc@ifactory.properties'|xargs perl -pi -e 's|wipUser|'${wipuser}'|g'
    find -name 'jdbc@ifactory.properties'|xargs perl -pi -e 's|8888888|'${wippassword}'|g'
    cd apache-tomcat-8.0/webapps/ifactory/WEB-INF/classes
    rm -f jdbc@ifactory.properties
    cd -
    cp jdbc@ifactory.properties apache-tomcat-8.0/webapps/ifactory/WEB-INF/classes
    #Start Tomcat Server
    echo "The database connection configuration is complete. Do you want to start the server?"
    echo " Determine, enter: y; Otherwise, enter: n"
    read input2
    if [ ${input2} == ${enter1} ]
    then
    cd apache-tomcat-8.0/bin
    chmod +x *
    sh startup.sh
    cd ..
    cd logs
    tail -f catalina.out
    else
    exit
    fi
  • 相关阅读:
    POJ 3026
    POJ 1258
    POJ 1751
    一种用于三维物体建模的精确、鲁棒的距离图像配准算法
    人脸识别技术介绍和表情识别最新研究
    汇总|实时性语义分割算法(共24篇)
    ECCV2020最佳论文解读之递归全对场变换(RAFT)光流计算模型
    三维重建的定位定姿算法
    多视图几何三维重建实战系列- Cascade-MVSNet
    HybridPose:混合表示下的6D对象姿态估计
  • 原文地址:https://www.cnblogs.com/26JRS/p/6515695.html
Copyright © 2020-2023  润新知