溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

OGG運維優化腳本(十九)-進程操作類--輔助操作

發布時間:2020-07-19 23:47:08 來源:網絡 閱讀:1122 作者: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

亚洲午夜精品一区二区_中文无码日韩欧免_久久香蕉精品视频_欧美主播一区二区三区美女