OGG运维优化脚本(十九)-进程操作类--辅助操作
短信预约 -IT技能 免费直播动态提醒
文件: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
免责声明:
① 本站未注明“稿件来源”的信息均来自网络整理。其文字、图片和音视频稿件的所属权归原作者所有。本站收集整理出于非商业性的教育和科研之目的,并不意味着本站赞同其观点或证实其内容的真实性。仅作为临时的测试数据,供内部测试之用。本站并未授权任何人以任何方式主动获取本站任何信息。
② 本站未注明“稿件来源”的临时测试数据将在测试完成后最终做删除处理。有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341