Procházet zdrojové kódy

Del Tomcat debug=0

lj2007331@gmail.com před 8 roky
rodič
revize
a50f3b475b
9 změnil soubory, kde provedl 54 přidání a 48 odebrání
  1. 17 17
      backup_setup.sh
  2. 0 1
      config/server.xml
  3. 1 1
      include/check_sw.sh
  4. 1 1
      include/tomcat-6.sh
  5. 1 1
      include/tomcat-7.sh
  6. 1 1
      include/tomcat-8.sh
  7. 18 11
      tools/coscmd
  8. 11 11
      versions.txt
  9. 4 4
      vhost.sh

+ 17 - 17
backup_setup.sh

@@ -19,6 +19,7 @@ printf "
 "
 
 . ./options.conf
+. ./versions.txt
 . ./include/color.sh
 . ./include/check_dir.sh
 . ./include/python.sh
@@ -34,9 +35,9 @@ while :; do echo
   echo -e "\t${CMSG}4${CEND}. Localhost and Remote host"
   echo -e "\t${CMSG}5${CEND}. Localhost and Qcloud COS"
   echo -e "\t${CMSG}6${CEND}. Remote host and Qcloud COS"
-  read -p "Please input a number:(Default 1 press Enter) " DESC_BK 
+  read -p "Please input a number:(Default 1 press Enter) " DESC_BK
   [ -z "$DESC_BK" ] && DESC_BK=1
-  if [[ ! $DESC_BK =~ ^[1-6]$ ]];then 
+  if [[ ! $DESC_BK =~ ^[1-6]$ ]]; then
     echo "${CWARNING}input error! Please only input number 1,2,3,4,5,6${CEND}"
   else
     break
@@ -57,7 +58,7 @@ while :; do echo
   echo -e "\t${CMSG}3${CEND}. Database and Website"
   read -p "Please input a number:(Default 1 press Enter) " CONTENT_BK
   [ -z "$CONTENT_BK" ] && CONTENT_BK=1
-  if [[ ! $CONTENT_BK =~ ^[1-3]$ ]];then 
+  if [[ ! $CONTENT_BK =~ ^[1-3]$ ]]; then
     echo "${CWARNING}input error! Please only input number 1,2,3${CEND}"
   else
     break
@@ -68,10 +69,10 @@ done
 [ "$CONTENT_BK" == '2' ] && sed -i 's@^backup_content=.*@backup_content=web@' ./options.conf
 [ "$CONTENT_BK" == '3' ] && sed -i 's@^backup_content=.*@backup_content=db,web@' ./options.conf
 
-if [ "$DESC_BK" != '3' ];then 
+if [ "$DESC_BK" != '3' ]; then
   while :; do echo
     echo "Please enter the directory for save the backup file: "
-    read -p "(Default directory: $backup_dir): " NEW_backup_dir 
+    read -p "(Default directory: $backup_dir): " NEW_backup_dir
     [ -z "$NEW_backup_dir" ] && NEW_backup_dir="$backup_dir"
     if [ -z "`echo $NEW_backup_dir| grep '^/'`" ]; then
       echo "${CWARNING}input error! ${CEND}"
@@ -84,13 +85,13 @@ fi
 
 while :; do echo
   echo "Pleas enter a valid backup number of days: "
-  read -p "(Default days: 5): " expired_days 
+  read -p "(Default days: 5): " expired_days
   [ -z "$expired_days" ] && expired_days=5
   [ -n "`echo $expired_days | sed -n "/^[0-9]\+$/p"`" ] && break || echo "${CWARNING}input error! Please only enter numbers! ${CEND}"
 done
 sed -i "s@^expired_days=.*@expired_days=$expired_days@" ./options.conf
 
-if [ "$CONTENT_BK" != '2' ];then
+if [ "$CONTENT_BK" != '2' ]; then
   databases=`$db_install_dir/bin/mysql -uroot -p$dbrootpwd -e "show databases\G" | grep Database | awk '{print $2}' | grep -Evw "(performance_schema|information_schema|mysql|sys)"`
   while :; do echo
     echo "Please enter one or more name for database, separate multiple database names with commas: "
@@ -129,17 +130,17 @@ echo "You have to backup the content:"
 [ "$CONTENT_BK" != '2' ] && echo "Database: ${CMSG}$db_name${CEND}"
 [ "$CONTENT_BK" != '1' ] && echo "Website: ${CMSG}$website_name${CEND}"
 
-if [[ "$DESC_BK" =~ ^[2,4,6]$ ]];then 
+if [[ "$DESC_BK" =~ ^[2,4,6]$ ]]; then
   > tools/iplist.txt
   while :; do echo
     read -p "Please enter the remote host ip: " remote_ip
     [ -z "$remote_ip" -o "$remote_ip" == '127.0.0.1' ] && continue
     echo
     read -p "Please enter the remote host port(Default: 22) : " remote_port
-    [ -z "$remote_port" ] && remote_port=22 
+    [ -z "$remote_port" ] && remote_port=22
     echo
     read -p "Please enter the remote host user(Default: root) : " remote_user
-    [ -z "$remote_user" ] && remote_user=root 
+    [ -z "$remote_user" ] && remote_user=root
     echo
     read -p "Please enter the remote host password: " remote_password
     IPcode=$(echo "ibase=16;$(echo "$remote_ip" | xxd -ps -u)"|bc|tr -d '\\'|tr -d '\n')
@@ -147,11 +148,11 @@ if [[ "$DESC_BK" =~ ^[2,4,6]$ ]];then
     PWcode=$(echo "ibase=16;$(echo "$remote_password" | xxd -ps -u)"|bc|tr -d '\\'|tr -d '\n')
     [ -e "~/.ssh/known_hosts" ] && grep $remote_ip ~/.ssh/known_hosts | sed -i "/$remote_ip/d" ~/.ssh/known_hosts
     ./tools/mssh.exp ${IPcode}P $remote_user ${PWcode}P ${Portcode}P true 10
-    if [ $? -eq 0 ];then
+    if [ $? -eq 0 ]; then
       [ -z "`grep $remote_ip tools/iplist.txt`" ] && echo "$remote_ip $remote_port $remote_user $remote_password" >> tools/iplist.txt || echo "${CWARNING}$remote_ip has been added! ${CEND}"
       while :; do
-        read -p "Do you want to add more host ? [y/n]: " more_host_yn 
-        if [ "$more_host_yn" != 'y' -a "$more_host_yn" != 'n' ];then
+        read -p "Do you want to add more host ? [y/n]: " more_host_yn
+        if [ "$more_host_yn" != 'y' -a "$more_host_yn" != 'n' ]; then
           echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}"
         else
           break
@@ -162,26 +163,25 @@ if [[ "$DESC_BK" =~ ^[2,4,6]$ ]];then
   done
 fi
 
-if [[ "$DESC_BK" =~ ^[3,5,6]$ ]];then 
+if [[ "$DESC_BK" =~ ^[3,5,6]$ ]]; then
   [ ! -e "${python_install_dir}/bin/python" ] && Install_Python
   [ ! -e "${python_install_dir}/lib/python2.7/site-packages/requests" ] && ${python_install_dir}/bin/pip install requests
   while :; do echo
     echo 'Please select your backup datacenter:'
-    echo -e "\t ${CMSG}1${CEND}. 华南(广州)  ${CMSG}2${CEND}. 华北(天津)" 
+    echo -e "\t ${CMSG}1${CEND}. 华南(广州)  ${CMSG}2${CEND}. 华北(天津)"
     echo -e "\t ${CMSG}3${CEND}. 华东(上海)  ${CMSG}4${CEND}. 新加坡"
     read -p "Please input a number:(Default 1 press Enter) " Location
     [ -z "$Location" ] && Location=1
     if [ ${Location} -ge 1 >/dev/null 2>&1 -a ${Location} -le 4 >/dev/null 2>&1 ]; then
       break
     else
-      echo "${CWARNING}input error! Please only input number 1~4${CEND}"
+      echo "${CWARNING}input error! Please only input number 1,2,3,4${CEND}"
     fi
   done
   [ "$Location" == '1' ] && region=gz
   [ "$Location" == '2' ] && region=tj
   [ "$Location" == '3' ] && region=sh
   [ "$Location" == '4' ] && region=sgp
-  [ -e "/root/.coscredentials" ] && rm -rf /root/.coscredentials
   while :; do echo
     read -p "Please enter the Qcloud COS appid: " appid 
     [ -z "$appid" ] && continue

+ 0 - 1
config/server.xml

@@ -27,7 +27,6 @@
               minSpareThreads="20"
               acceptCount="1000"
               maxHttpHeaderSize="65536"
-              debug="0"
               disableUploadTimeout="true"
               useBodyEncodingForURI="true"
               enableLookups="false"

+ 1 - 1
include/check_sw.sh

@@ -139,7 +139,7 @@ installDepsBySrc() {
 
       tar xzf tmux-${tmux_version}.tar.gz
       pushd tmux-${tmux_version}
-      CFLAGS="-I/usr/local/include" LDFLAGS="-L//usr/local/lib" ./configure
+      CFLAGS="-I/usr/local/include" LDFLAGS="-L/usr/local/lib" ./configure
       make -j ${THREAD} && make install
       unset LDFLAGS
       popd

+ 1 - 1
include/tomcat-6.sh

@@ -89,7 +89,7 @@ EOF
     [ ! -d "${tomcat_install_dir}/conf/vhost" ] && mkdir ${tomcat_install_dir}/conf/vhost
     cat > ${tomcat_install_dir}/conf/vhost/localhost.xml << EOF
 <Host name="localhost" appBase="${wwwroot_dir}/default" unpackWARs="true" autoDeploy="true">
-  <Context path="" docBase="${wwwroot_dir}/default" debug="0" reloadable="false" crossContext="true"/>
+  <Context path="" docBase="${wwwroot_dir}/default" reloadable="false" crossContext="true"/>
   <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
     prefix="localhost_access_log" suffix=".txt" pattern="%h %l %u %t &quot;%r&quot; %s %b" />
 </Host>

+ 1 - 1
include/tomcat-7.sh

@@ -89,7 +89,7 @@ EOF
     [ ! -d "${tomcat_install_dir}/conf/vhost" ] && mkdir ${tomcat_install_dir}/conf/vhost
     cat > ${tomcat_install_dir}/conf/vhost/localhost.xml << EOF
 <Host name="localhost" appBase="${wwwroot_dir}/default" unpackWARs="true" autoDeploy="true">
-  <Context path="" docBase="${wwwroot_dir}/default" debug="0" reloadable="false" crossContext="true"/>
+  <Context path="" docBase="${wwwroot_dir}/default" reloadable="false" crossContext="true"/>
   <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
     prefix="localhost_access_log" suffix=".txt" pattern="%h %l %u %t &quot;%r&quot; %s %b" />
 </Host>

+ 1 - 1
include/tomcat-8.sh

@@ -89,7 +89,7 @@ EOF
     [ ! -d "${tomcat_install_dir}/conf/vhost" ] && mkdir ${tomcat_install_dir}/conf/vhost
     cat > ${tomcat_install_dir}/conf/vhost/localhost.xml << EOF
 <Host name="localhost" appBase="${wwwroot_dir}/default" unpackWARs="true" autoDeploy="true">
-  <Context path="" docBase="${wwwroot_dir}/default" debug="0" reloadable="false" crossContext="true"/>
+  <Context path="" docBase="${wwwroot_dir}/default" reloadable="false" crossContext="true"/>
   <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
     prefix="localhost_access_log" suffix=".txt" pattern="%h %l %u %t &quot;%r&quot; %s %b" />
 </Host>

+ 18 - 11
tools/coscmd

@@ -128,14 +128,14 @@ def loginit():
     if log_level == 2:
         log_level = logging.WARNING
 
-        #定义一个RotatingFileHandler,最多备份5个日志文件,每个日志文件最大20M
+    #定义一个RotatingFileHandler,最多备份5个日志文件,每个日志文件最大20M
     logger = logging.getLogger("")
     Rthandler = RotatingFileHandler(log_file_name, maxBytes= 20*1024*1024,backupCount=5)
     Rthandler.setLevel(log_level)
     formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s')
     Rthandler.setFormatter(formatter)
     logger.addHandler(Rthandler)
-        #输出日志到屏幕
+    #输出日志到屏幕
     console = logging.StreamHandler()
     console.setFormatter(formatter)
     if (log_out_to_screen == 1):
@@ -222,7 +222,7 @@ class FileStat():
 class TimeStat(object):
     global cos_log
     def __init__(self):
-        self.start()
+	self.start()
     def start(self):
         self.start = datetime.datetime.now()
         self.t1 = time.time()
@@ -242,6 +242,7 @@ def delfiles(cos_client, bucket, filelist):
 def delfolders(cos_client, bucket, folderlist):
     for f in folderlist:
         delfolder(cos_client, bucket, f)
+
 #文件夹删除
 def delfolder(cos_client, bucket, folder):
     global stat
@@ -252,7 +253,8 @@ def delfolder(cos_client, bucket, folder):
     retry = 0
     while (retry < MAX_RETRY_TIMES):
         ret = cos_client.del_folder(delfolderreq)
-        msg = "delfolder fail, bucket="+bucket+",folder="+folder+ret['message']
+        #msg = "delfolder fail, bucket="+bucket+",folder="+folder+ret['message']
+        msg = "delfolder fail, bucket="+bucket+",folder="+folder+str(ret.get('message'))
         if (ret['code'] == 0):
             break
         elif (ret['code'] == -166):
@@ -272,7 +274,8 @@ def delfolder(cos_client, bucket, folder):
             retry += 1
     if (ret['code'] != 0 and  ret['code'] != -166):
         stat.addDelDirFailNum()
-        cos_log.error("delfolder fail, bucket="+bucket+",folder="+folder+ret['message'])
+        #cos_log.error("delfolder fail, bucket="+bucket+",folder="+folder+ret['message'])
+        cos_log.error("delfolder fail, bucket="+bucket+",folder="+folder+str(ret.get('message')))
         return ret['code']
     if (ret['code'] == 0):
         stat.addDelDirSuccNum()
@@ -288,7 +291,8 @@ def delfile(cos_client, bucket, filepath):
     retry = 0
     while (retry < MAX_RETRY_TIMES):
         ret = cos_client.del_file(delfilereq)
-        msg = "delfile fail bucket="+bucket+",file="+filepath+ret['message']
+        #msg = "delfile fail bucket="+bucket+",file="+filepath+ret['message']
+        msg = "delfile fail bucket="+bucket+",file="+filepath+str(ret.get('message'))
         if (ret['code'] == 0):
             break
         #文件不存在
@@ -313,7 +317,8 @@ def delfile(cos_client, bucket, filepath):
             continue
     if (ret['code'] != 0 and  ret['code'] != -166):
         stat.addDelFileFailNum()
-        cos_log.error("delfile fail, bucket="+bucket+",file="+filepath+ret['message'])
+        #cos_log.error("delfile fail, bucket="+bucket+",file="+filepath+ret['message'])
+        cos_log.error("delfile fail, bucket="+bucket+",file="+filepath+str(ret.get('message')))
         return ret['code']
     if (ret['code'] == 0):
         stat.addDelFileSuccNum()
@@ -341,7 +346,8 @@ def delete_r(cos_client, bucket, path, thread_pool_file):
             else:
                 break
         if (listret['code'] != 0):
-            cos_log.error("delete_r: list folder fail:"+path +",return msg:"+ listret['message'])
+            #cos_log.error("delete_r: list folder fail:"+path +",return msg:"+ listret['message'])
+            cos_log.error("delete_r: list folder fail:"+path +",return msg:"+ str(listret.get('message')))
             return listret['code']
         if (len(listret['data']['infos']) == 0):
             break;
@@ -388,7 +394,7 @@ def delete_r(cos_client, bucket, path, thread_pool_file):
                 filelist = []
         else:
             pass
-
+		
         if (len(dirlist) > 0):
             args = [cos_client, bucket, dirlist]
             args_tuple = (args,None)
@@ -412,9 +418,9 @@ def delete_r(cos_client, bucket, path, thread_pool_file):
 
     stat.logStat()
     return 0
+
 #支持Ctrl+C终止程序
 class Watcher():
-             
     def __init__(self):
         self.child = os.fork()
         if self.child == 0:
@@ -427,7 +433,7 @@ class Watcher():
         try: 
             os.wait()
         except KeyboardInterrupt:
-            cos_log.ERROR("ctrl+c terminated rm_recursive.py, exiting...")                                                                                        
+            cos_log.ERROR("ctrl+c terminated coscmd, exiting...")                                                                                        
             self.kill()
         sys.exit()
     def kill(self):
@@ -435,6 +441,7 @@ class Watcher():
             os.kill(self.child, signal.SIGKILL)
         except OSError:
             pass
+
 def cmd_rm(COSDIR):
     global thread_pool
     global cos_log

+ 11 - 11
versions.txt

@@ -1,31 +1,31 @@
 # newest software version
 # Web
-nginx_version=1.10.3
+nginx_version=1.12.0
 tengine_version=2.1.2
 openresty_version=1.11.2.2
 openssl_version=1.0.2k
 
-tomcat8_version=8.0.43
+tomcat8_version=8.5.14
 tomcat7_version=7.0.77
-tomcat6_version=6.0.51
+tomcat6_version=6.0.53
 
 apache24_version=2.4.25
 apache22_version=2.2.32
 pcre_version=8.40
 apr_version=1.5.2
 apr_util_version=1.5.4
-nghttp2_version=1.21.0
+nghttp2_version=1.21.1
 
 # DB
-mysql57_version=5.7.17
-mysql56_version=5.6.35
-mysql55_version=5.5.54
+mysql57_version=5.7.18
+mysql56_version=5.6.36
+mysql55_version=5.5.55
 
 mariadb101_version=10.1.22
 mariadb100_version=10.0.30
 mariadb55_version=5.5.54
 
-percona57_version=5.7.17-12
+percona57_version=5.7.17-13
 percona56_version=5.6.35-81.0
 percona55_version=5.5.54-38.7
 
@@ -37,8 +37,8 @@ jdk17_version=1.7.0_80
 jdk16_version=1.6.0_45
 
 # PHP
-php71_version=7.1.3
-php70_version=7.0.17
+php71_version=7.1.4
+php70_version=7.0.18
 php56_version=5.6.30
 php55_version=5.5.38
 php54_version=5.4.45
@@ -86,7 +86,7 @@ jemalloc_version=4.5.0
 boost_version=1.59.0
 
 # Others
-libevent_version=2.1.8-stable
+libevent_version=2.0.22-stable
 tmux_version=2.3
 htop_version=2.0.2
 bison_version=2.7.1

+ 4 - 4
vhost.sh

@@ -504,9 +504,9 @@ EOF
 
   cat > ${tomcat_install_dir}/conf/vhost/${domain}.xml << EOF
 <Host name="${domain}" appBase="${vhostdir}" unpackWARs="true" autoDeploy="true"> ${Tomcat_Domain_alias}
-  <Context path="" docBase="${vhostdir}" debug="0" reloadable="false" crossContext="true"/>
+  <Context path="" docBase="${vhostdir}" reloadable="false" crossContext="true"/>
   <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
-    prefix="${domain}_access_log." suffix=".txt" pattern="%h %l %u %t &quot;%r&quot; %s %b" />
+    prefix="${domain}_access_log" suffix=".txt" pattern="%h %l %u %t &quot;%r&quot; %s %b" />
 </Host>
 EOF
   [ -z "$(grep -o "vhost-${domain} SYSTEM" ${tomcat_install_dir}/conf/server.xml)" ] && sed -i "/vhost-localhost SYSTEM/a<\!ENTITY vhost-${domain} SYSTEM \"file://${tomcat_install_dir}/conf/vhost/${domain}.xml\">" ${tomcat_install_dir}/conf/server.xml
@@ -540,9 +540,9 @@ EOF
 Create_tomcat_conf() {
   cat > ${tomcat_install_dir}/conf/vhost/${domain}.xml << EOF
 <Host name="${domain}" appBase="webapps" unpackWARs="true" autoDeploy="true"> ${Tomcat_Domain_alias}
-  <Context path="" docBase="${vhostdir}" debug="0" reloadable="false" crossContext="true"/>
+  <Context path="" docBase="${vhostdir}" reloadable="false" crossContext="true"/>
   <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
-    prefix="${domain}_access_log." suffix=".txt" pattern="%h %l %u %t &quot;%r&quot; %s %b" />
+    prefix="${domain}_access_log" suffix=".txt" pattern="%h %l %u %t &quot;%r&quot; %s %b" />
 </Host>
 EOF
   [ -z "$(grep -o "vhost-${domain} SYSTEM" ${tomcat_install_dir}/conf/server.xml)" ] && sed -i "/vhost-localhost SYSTEM/a<\!ENTITY vhost-${domain} SYSTEM \"file://${tomcat_install_dir}/conf/vhost/${domain}.xml\">" ${tomcat_install_dir}/conf/server.xml