Tomcat重启脚本

#!/bin/bash
pid=`ps aux | grep tomcat | grep -v grep| awk '{print $2}'`
echo $pid
if [ -n "$pid" ]
  then
     echo ========shutdown=======
     su -c /opt/tomcat/lms_enterprise/bin/shutdown.sh ambow
     su -c /opt/tomcat/lms_system/bin/shutdown.sh ambow
     sleep 10  

     pid=`ps aux | grep tomcat | grep -v grep| awk '{print $2}'`
     if [ -n "$pid" ]
       then
          sleep 10   
          echo ========kill tomcat begin=======
          echo $pid
          kill -9 $pid
          echo ========kill tomcat end========
      fi
  sleep 10  

  echo ========startup========
  #/opt/tomcat/lms_enterprise/bin/startup.sh
  #pid=`ps aux | grep tomcat | grep -v grep| grep root | awk '{print $2}'`
  #kill -9 $pid
  su -c /opt/tomcat/lms_enterprise/bin/startup.sh ambow
  su -c /opt/tomcat/lms_system/bin/startup.sh ambow
fi

解决自动重启后的乱码问题:
00 01 * * * /bin/bash -l -c /root/bin.sh >/dev/null 2>&1
    -l:选项 执行脚本 登录 环境

你可能感兴趣的:(tomcat,职场,休闲,重启乱码)