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
网友评论