• tomcat启动脚本


    #!/bin/bash
    #tomcat start.sh
    NAME=tomcat
    export JAVA_HOME=/usr/local/java/jdk1.8.0_181
    Tomcat_Path=/data/tomcat/
    Pid_List=`ps -ef |grep tomcat|grep -v "grep"| awk '{print $2}' |sed -n 1p`
    Tomcat_Home=/data/tomcat
    Tomcat_doc=/data/www/kstore
    war=/htdocs/war/
    module="boss mobile third"
    Start_Scripts=/data/tomcat/bin/startup.sh
    Shutdown_Scripts=/data/tomcat/bin/shutdown.sh
    Log_Backup=/data/tomcat_log_backup
    Remote_Host=192.168.1.110
    if [ -d $Log_Backup ];then
        echo ""
    else
        mkdir -p $Log_Backup
    fi
    
    #if [ -s /bin/ss ]; then
    #    StatBin=/bin/ss
    #else
    #    StatBin=/bin/netstat
    #fi
    
    case $1 in
        start)
    	echo "start run tomcat"
    	if /bin/ps -ef | grep -q|grep -v grep tomcat;then
                echo "$NAME (pid:"$Pid_List") already running."
    	    exit 1
            fi	
    	$Start_Scripts
    	if [ "$?" != 0 ] ; then
                echo "run faild"
                exit 1
            else
                echo -e "33[32m tomcat run done 33[0m"
            fi
            ;;
        stop)
    	echo "stop tomcat service"
    	if ! /bin/ps -ef  | grep -v grep | grep -q tomcat;then
                echo "$NAME is not running"
                exit 1
            fi
    	$Shutdown_Scripts
    #        Pid_List=`ps -ef |grep tomcat|grep -v "grep"| awk '{print $2}'`
    	kill -9 $Pid_List
    	if [ "$?" != 0 ] ; then
                echo " $NAME stopping failed"
                exit 1
            else
                echo -e "33[32m tomcat service closed  33[0m"
    #############清空缓存##################################################	    
    	    sync
                echo 3 > /proc/sys/vm/drop_caches
    #############清空日志###################################################
    	    mv $Tomcat_Path/logs/* $Log_Backup
    ############输出本地日志到天津服务器####################################
    	    cd $Log_Backup
    	    tar -zcvf "`date +%F-%H%M%S`_tomcat_log.tar.gz" $Log_Backup/*
    	    rsync -az "`date +%F-%H%M%S`_tomcat_log.tar.gz" root@$Remote_Host:/tmp
    		
            fi
            ;;
    	
        *)
    	echo "please input {start|stop|}"
    	exit 1
    	;;
    esac
    

      

  • 相关阅读:
    [SQL Server]如何激活一个账号
    sqlcmd命令详解
    SQL Server Express 2008 安装程序
    SharePoint中的本地化(Localization)
    2009十大企业应用产品
    2010年10大战略技术
    十个理由促使小企业敢于触碰“云计算”
    如何改进网站性能
    sqlcmd详细示例
    VMware网络配置详解
  • 原文地址:https://www.cnblogs.com/python-cat/p/10027978.html
Copyright © 2020-2023  润新知