温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

OGG运维优化脚本(十九)-进程操作类--辅助操作

发布时间:2020-07-19 23:47:08 来源:网络 阅读:1069 作者:netsman1030 栏目:关系型数据库

文件:info.sh  start.sh  stop.sh

路径 $HOME/ggscript/ggoperat

因为编写了太多脚本后有时候为了查看OGG运行状态不得不频繁的在GGSCI和系统界面切换,所以为了便捷自己写了几个比较简单的脚本,配合alias别名,模拟ggsci内的info start stop功能。同时这几个脚本也可以被其他脚本调用用于操作或者获取进程状态


info.sh

#!/bin/bash
if [ $# -eq 0 ]; then
        echo "INFO EXTRACT"
        exit 2
fi

echo $dir
cd $HOME/ggscript/ggoperat
dir=$PWD
cd $HOME
if [ -f .profile ];then
        . .profile
fi

if [ -f .bash_profile ];then 
        . .bash_profile
fi
cd $dir

backuptime=`date +%Y%m%d-%H%M%S`

val=$1
val=`echo $val|tr a-z A-Z`

if [ `echo $val|grep ^E` ];then
         IType=EXTRACT

elif [ `echo $val|grep ^P` ];then
         IType=POST

elif  [ `echo $val|grep ^R` ];then
       	IType=REPLICAT 
else
        echo "only can operate the EXTRACT REPLICAT and the POST process"       
        exit 2
fi

pro=`echo $val.PRM|tr A-Z a-z`

cd $HOME/ggserver/dirprm
if [ ! -e $pro ]; then
        echo "the PROCESS is not exist"
        exit 2
fi

#cd $HOME/ggscript/ggoperat
cd $HOME/ggserver

(echo INFO $val;echo exit)|./ggsci



start.sh

#!/bin/bash
if [ $# -eq 0 ]; then
        echo "START EXTRACT"
        exit 2
fi

echo $dir
cd $HOME/ggscript/ggoperat
dir=$PWD
cd $HOME
if [ -f .profile ];then
        . .profile
fi

if [ -f .bash_profile ];then 
        . .bash_profile
fi
cd $dir

backuptime=`date +%Y%m%d-%H%M%S`

val=$1
val=`echo $val|tr a-z A-Z`

if [ `echo $val|grep ^E` ];then
         IType=EXTRACT

elif [ `echo $val|grep ^P` ];then
         IType=POST

elif  [ `echo $val|grep ^R` ];then
       	IType=REPLICAT 
else
        echo "only can operate the EXTRACT REPLICAT and the POST process"       
        exit 2
fi

pro=`echo $val.PRM|tr A-Z a-z`

cd $HOME/ggserver/dirprm
if [ ! -e $pro ]; then
        echo "the PROCESS is not exist"
        exit 2
fi

#cd $HOME/ggscript/ggoperat
cd $HOME/ggserver

(echo START $val;echo exit)|./ggsci


stop.sh

#!/bin/bash
if [ $# -eq 0 ]; then
        echo "STOP EXTRACT"
        exit 2
fi

echo $dir
cd $HOME/ggscript/ggoperat
dir=$PWD
cd $HOME
if [ -f .profile ];then
        . .profile
fi

if [ -f .bash_profile ];then 
        . .bash_profile
fi
cd $dir

backuptime=`date +%Y%m%d-%H%M%S`

val=$1
val=`echo $val|tr a-z A-Z`

if [ `echo $val|grep ^E` ];then
         IType=EXTRACT

elif [ `echo $val|grep ^P` ];then
         IType=POST

elif  [ `echo $val|grep ^R` ];then
       	IType=REPLICAT 
else
        echo "only can operate the EXTRACT REPLICAT and the POST process"       
        exit 2
fi

pro=`echo $val.PRM|tr A-Z a-z`

cd $HOME/ggserver/dirprm
if [ ! -e $pro ]; then
        echo "the PROCESS is not exist"
        exit 2
fi

#cd $HOME/ggscript/ggoperat
cd $HOME/ggserver

(echo STOP $val;echo exit)|./ggsci


向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI