Browse Source

Fix cos backup

lj2007331@gmail.com 7 years ago
parent
commit
29a623c20a
3 changed files with 13 additions and 15 deletions
  1. 2 2
      backup.sh
  2. 9 11
      backup_setup.sh
  3. 2 2
      versions.txt

+ 2 - 2
backup.sh

@@ -39,7 +39,7 @@ DB_COS_BK() {
     DB_GREP="DB_${D}_`date +%Y`"
     DB_FILE=`ls -lrt $backup_dir | grep ${DB_GREP} | tail -1 | awk '{print $NF}'`
     ${python_install_dir}/bin/coscmd upload $backup_dir/$DB_FILE /`date +%F`/$DB_FILE
-    [ $? -eq 0 ] && ${python_install_dir}/bin/coscmd delete -r `date +%F --date="$expired_days days ago"` > /dev/null 2>&1
+    [ $? -eq 0 ] && ${python_install_dir}/bin/coscmd delete -r -f `date +%F --date="$expired_days days ago"` > /dev/null 2>&1
   done
 }
 
@@ -76,7 +76,7 @@ WEB_COS_BK() {
       popd
     fi
     ${python_install_dir}/bin/coscmd upload $PUSH_FILE /`date +%F`/Web_${W}_$(date +%Y%m%d_%H).tgz
-    [ $? -eq 0 ] && { [ -e "$PUSH_FILE" ] && rm -rf $PUSH_FILE; ${python_install_dir}/bin/coscmd delete -r `date +%F --date="$expired_days days ago"` > /dev/null 2>&1; }
+    [ $? -eq 0 ] && { [ -e "$PUSH_FILE" ] && rm -rf $PUSH_FILE; ${python_install_dir}/bin/coscmd delete -r -f `date +%F --date="$expired_days days ago"` > /dev/null 2>&1; }
   done
 }
 

+ 9 - 11
backup_setup.sh

@@ -169,8 +169,6 @@ fi
 if [[ "$DESC_BK" =~ ^[3,5,6]$ ]]; then
   [ ! -e "${python_install_dir}/bin/python" ] && Install_Python
   [ ! -e "${python_install_dir}/lib/coscmd" ] && ${python_install_dir}/bin/pip install coscmd >/dev/null 2>&1 
-  sed -i "/if query_yes_no/{ n; s/^.*/#&/; }" ${python_install_dir}/lib/python2.7/site-packages/coscmd/cos_client.py
-  sed -i "s/if query_yes_no/#if query_yes_no/" ${python_install_dir}/lib/python2.7/site-packages/coscmd/cos_client.py
   while :; do echo
     echo 'Please select your backup datacenter:'
     echo -e "\t ${CMSG}1${CEND}. 北京一区(华北)  ${CMSG}2${CEND}. 北京"
@@ -196,26 +194,26 @@ if [[ "$DESC_BK" =~ ^[3,5,6]$ ]]; then
   [ "$Location" == '8' ] && region='na-toronto'
   [ "$Location" == '9' ] && region='eu-frankfurt'
   while :; do echo
-    read -p "Please enter the Qcloud COS appid: " appid 
+    read -p "Please enter the Qcloud COS APPID: " appid 
     [ -z "$appid" ] && continue
     echo
-    read -p "Please enter the Qcloud COS secret id: " secret_id
-    [ -z "$secret_id" ] && continue
+    read -p "Please enter the Qcloud COS SecretId: " SecretId
+    [ -z "$SecretId" ] && continue
     echo
-    read -p "Please enter the Qcloud COS secret key: " secret_key
-    [ -z "$secret_key" ] && continue
+    read -p "Please enter the Qcloud COS SecretKey: " SecretKey
+    [ -z "$SecretKey" ] && continue
     echo
     read -p "Please enter the Qcloud COS bucket: " bucket 
     [ -z "$bucket" ] && continue
     echo
-    $python_install_dir/bin/coscmd config -u $appid -a $secret_id -s $secret_key -r $region -b $bucket >/dev/null 2>&1
-    $python_install_dir/bin/coscmd delete oneinstack.test >/dev/null 2>&1
+    $python_install_dir/bin/coscmd config -u $appid -a $SecretId -s $SecretKey -r $region -b $bucket >/dev/null 2>&1
+    $python_install_dir/bin/coscmd list >/dev/null 2>&1
     if [ $? = 0 ];then
-      echo "${CMSG}appid/secret_id/secret_key/region/bucket OK${CEND}"
+      echo "${CMSG}appid/SecretId/SecretKey/region/bucket OK${CEND}"
       echo
       break
     else
-      echo "${CWARNING}input error! appid/secret_id/secret_key/region/bucket invalid${CEND}"
+      echo "${CWARNING}input error! appid/SecretId/SecretKey/region/bucket invalid${CEND}"
     fi
   done
 fi

+ 2 - 2
versions.txt

@@ -5,7 +5,7 @@ tengine_version=2.2.1
 openresty_version=1.13.6.1
 openssl_version=1.0.2m
 
-tomcat8_version=8.5.23
+tomcat8_version=8.5.24
 tomcat7_version=7.0.82
 tomcat6_version=6.0.53
 
@@ -47,7 +47,7 @@ php54_version=5.4.45
 php53_version=5.3.29
 
 libiconv_version=1.15
-curl_version=7.56.1
+curl_version=7.57.0
 libmcrypt_version=2.5.8
 mcrypt_version=2.6.8
 mhash_version=0.9.9.9