自動 deploy 標準範例

 
#!/bin/bash
EAR=/home/mpap/mp.war
LOG=/home/mpap/deploy.log
CHECKSUM=`md5sum $EAR | cut -d' ' -f1`
echo "Redeploy : $CHECKSUM  $EAR"
echo "======`date` Redeploy =====    $CHECKSUM  $EAR" >> "$LOG"
rm /usr/local/tomcat/webapps/mp.war
sleep 10
cp /home/mpap/mp.war /usr/local/tomcat/webapps/
sleep 10
 
echo shutdown tomcat
/usr/local/tomcat/bin/shutdown.sh
sleep 1
echo check tomcat process
CNT=`ps auxwww|grep -v 'grep'|grep 'java'|wc -l`
if [ $CNT = '1' ]
then
    PROCESS_ID=`ps auxwww|grep -v 'grep'|grep java | awk '{print $2}'`
    echo kill tomcat process: $PROCESS_ID
    kill -9 $PROCESS_ID
fi
sleep 10
echo start tomcat process
/usr/local/tomcat/bin/startup.sh
#!/bin/bash
EAR=/home/mpap/mp.war
LOG=/home/mpap/deploy.log
CHECKSUM=`md5sum $EAR | cut -d' ' -f1`
echo "Redeploy : $CHECKSUM  $EAR"
echo "======`date` Redeploy =====    $CHECKSUM  $EAR" >> "$LOG"
rm /usr/local/tomcat/webapps/mp.war
sleep 10
cp /home/mpap/mp.war /usr/local/tomcat/webapps/
sleep 10
 
echo shutdown tomcat
/usr/local/tomcat/bin/shutdown.sh
sleep 1
echo check tomcat process
CNT=`ps auxwww|grep -v 'grep'|grep 'java'|wc -l`
if [ $CNT = '1' ]
then
    PROCESS_ID=`ps auxwww|grep -v 'grep'|grep java | awk '{print $2}'`
    echo kill tomcat process: $PROCESS_ID
    kill -9 $PROCESS_ID
fi
sleep 10
echo start tomcat process
/usr/local/tomcat/bin/startup.sh
 

 

© 2015 版權所有。

Create a website for freeWebnode