source /etc/profile
#export NLS_LANG=AMERICAN_AMERICA.UTF8
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
while [ 1 -le 2 ]
do
get_jar="ipranzdkt-0.0.1-SNAPSHOT.jar"
act=`sqlplus -s name/passward@lt_nrms <<EOF
set heading off
set pagesize 0
set verify off
set echo off
set linesize 255
set feedback off
select action from serverinfo where at_time<sysdate;
exit
EOF`
echo $act
PROCESS=`ps -ef|grep $get_jar|grep -v grep|grep -v PPID|awk '{ print $2}'`
echo $PROCESS
if [[ $act -eq 1 ]]; then
echo "act=1"
nohup java -jar $get_jar >run.log 2>&1 &
sqlplus name/passward@lt_nrms <<EOF
update serverinfo set action=0 where action in(1,2,3);
quit
EOF
elif [[ $act -eq 2 ]]; then
echo "act=2"
for i in $PROCESS
do
echo "Kill the $1 process [ $i ]"
kill -9 $i
done
sqlplus name/passward@lt_nrms <<EOF
update serverinfo set action=0 where action in(1,2,3);
quit
EOF
sleep 2000
elif [[ $act -eq 3 ]]; then
echo $basepath
echo "act=3"
rm -f $get_jar
ftp -inv 133.96.136.23 <<EOF
user nrms Nrms_1234!
lcd $basepath
cd jar
mget $get_jar
bye
EOF
for i in $PROCESS
do
echo "Kill the $1 process [ $i ]"
kill -9 $i
done
nohup java -jar $get_jar >run.log 2>&1 &
sqlplus name/passward@lt_nrms <<EOF
update serverinfo set action=0 where action in(1,2,3);
quit
echo 'reload finish!!!'
EOF
sleep 2000
else
echo "wait......"
sleep 2000
fi
done
shell 脚本示例 举例
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...