Browse Source

Add Qcloud COS backup

lj2007331@gmail.com 8 years ago
parent
commit
b23f778c72
9 changed files with 167 additions and 64 deletions
  1. 4 3
      addons.sh
  2. 53 5
      backup.sh
  3. 71 19
      backup_setup.sh
  4. 3 3
      include/check_sw.sh
  5. 2 0
      include/openssl.sh
  6. 23 20
      init.d/Nginx-init-CentOS
  7. 0 3
      reset_db_root_password.sh
  8. 10 10
      versions.txt
  9. 1 1
      vhost.sh

+ 4 - 3
addons.sh

@@ -18,6 +18,9 @@ printf "
 #######################################################################
 "
 
+# Check if user is root
+[ $(id -u) != '0' ] && { echo "${CFAILURE}Error: You must be root to run this script${CEND}"; exit 1; }
+
 # get pwd
 sed -i "s@^oneinstack_dir.*@oneinstack_dir=$(pwd)@" ./options.conf
 
@@ -47,9 +50,6 @@ sed -i "s@^oneinstack_dir.*@oneinstack_dir=$(pwd)@" ./options.conf
 
 . ./include/python.sh
 
-# Check if user is root
-[ $(id -u) != '0' ] && { echo "${CFAILURE}Error: You must be root to run this script${CEND}"; exit 1; }
-
 # Check PHP
 if [ -e "${php_install_dir}/bin/phpize" ]; then
   phpExtensionDir=$(${php_install_dir}/bin/php-config --extension-dir)
@@ -162,6 +162,7 @@ EOF
     endscript
 }
 EOF
+  sed -i 's@^iptables = iptables.*@iptables = iptables@' /etc/fail2ban/action.d/iptables-common.conf
   kill -9 `ps -ef | grep fail2ban | grep -v grep | awk '{print $2}'` > /dev/null 2>&1
   /etc/init.d/fail2ban start
   popd

+ 53 - 5
backup.sh

@@ -8,6 +8,9 @@
 #       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
+# Check if user is root
+[ $(id -u) != "0" ] && { echo "${CFAILURE}Error: You must be root to run this script${CEND}"; exit 1; }
+
 pushd tools > /dev/null
 . ../options.conf
 
@@ -29,6 +32,17 @@ DB_Remote_BK() {
   done
 }
 
+DB_COS_BK() {
+  for D in `echo $db_name | tr ',' ' '`
+  do
+    ./db_bk.sh $D
+    DB_GREP="DB_${D}_`date +%Y`"
+    DB_FILE=`ls -lrt $backup_dir | grep ${DB_GREP} | tail -1 | awk '{print $NF}'`
+    ${python_install_dir}/bin/python ./coscmd put $backup_dir/$DB_FILE /`date +%F`/$DB_FILE
+    [ $? -eq 0 ] && ${python_install_dir}/bin/python ./coscmd rm /`date +%F --date="$expired_days days ago"`/ > /dev/null 2>&1
+  done
+}
+
 WEB_Local_BK() {
   for W in `echo $website_name | tr ',' ' '`
   do
@@ -39,7 +53,7 @@ WEB_Local_BK() {
 WEB_Remote_BK() {
   for W in `echo $website_name | tr ',' ' '`
   do
-    if [ `du -sm "$wwwroot_dir/$WebSite" | awk '{print $1}'` -lt 1024 ]; then
+    if [ `du -sm "$wwwroot_dir/$WebSite" | awk '{print $1}'` -lt 1024 ];then
       ./website_bk.sh $W
       Web_GREP="Web_${W}_`date +%Y`"
       Web_FILE=`ls -lrt $backup_dir | grep ${Web_GREP} | tail -1 | awk '{print $NF}'`
@@ -51,19 +65,53 @@ WEB_Remote_BK() {
   done
 }
 
-if [ "$backup_destination" == 'local' ]; then
+WEB_COS_BK() {
+  for W in `echo $website_name | tr ',' ' '`
+  do
+    [ ! -e "$wwwroot_dir/$WebSite" ] && { echo "[$wwwroot_dir/$WebSite] not exist"; break; }
+    Web_FILE="Web_${W}_$(date +%Y%m%d_%H).tgz"
+    if [ ! -e "$backup_dir/$Web_FILE" ];then
+      pushd $wwwroot_dir
+      tar czf $Web_FILE ./$W
+      popd
+      PUSH_FILE="$wwwroot_dir/$Web_FILE"
+    else
+      PUSH_FILE="$backup_dir/$Web_FILE"
+    fi
+
+    ${python_install_dir}/bin/python ./coscmd put $PUSH_FILE /`date +%F`/$Web_FILE
+    [ $? -eq 0 ] && { [ -e "$wwwroot_dir/$Web_FILE" ] && rm -rf $wwwroot_dir/$Web_FILE; ${python_install_dir}/bin/python ./coscmd rm /`date +%F --date="$expired_days days ago"`/ > /dev/null 2>&1; }
+  done
+}
+
+if [ "$backup_destination" == 'local' ];then
   [ -n "`echo $backup_content | grep -ow db`" ] && DB_Local_BK
   [ -n "`echo $backup_content | grep -ow web`" ] && WEB_Local_BK
-elif [ "$backup_destination" == 'remote' ]; then
+elif [ "$backup_destination" == 'remote' ];then
   echo "com:::[ ! -e "$backup_dir" ] && mkdir -p $backup_dir" > config_bakcup.txt
   [ -n "`echo $backup_content | grep -ow db`" ] && DB_Remote_BK
   [ -n "`echo $backup_content | grep -ow web`" ] && WEB_Remote_BK
   ./mabs.sh -c config_bakcup.txt -T -1 | tee mabs.log
-elif [ "$backup_destination" == 'local,remote' ]; then
+elif [ "$backup_destination" == 'cos' ];then
+  [ -n "`echo $backup_content | grep -ow db`" ] && DB_COS_BK
+  [ -n "`echo $backup_content | grep -ow web`" ] && WEB_COS_BK
+elif [ "$backup_destination" == 'local,remote' ];then
   echo "com:::[ ! -e "$backup_dir" ] && mkdir -p $backup_dir" > config_bakcup.txt
   [ -n "`echo $backup_content | grep -ow db`" ] && DB_Local_BK
   [ -n "`echo $backup_content | grep -ow web`" ] && WEB_Local_BK
   [ -n "`echo $backup_content | grep -ow db`" ] && DB_Remote_BK
   [ -n "`echo $backup_content | grep -ow web`" ] && WEB_Remote_BK
-  ./mabs.sh -c config_bakcup.txt -T -1 | tee mabs.log
+  ./mabs.sh -c config_bakcup.txt -T -1 | tee mabs.log	
+elif [ "$backup_destination" == 'local,cos' ];then
+  [ -n "`echo $backup_content | grep -ow db`" ] && DB_Local_BK
+  [ -n "`echo $backup_content | grep -ow db`" ] && DB_COS_BK
+  [ -n "`echo $backup_content | grep -ow web`" ] && WEB_Local_BK
+  [ -n "`echo $backup_content | grep -ow web`" ] && WEB_COS_BK
+elif [ "$backup_destination" == 'remote,cos' ];then
+  echo "com:::[ ! -e "$backup_dir" ] && mkdir -p $backup_dir" > config_bakcup.txt
+  [ -n "`echo $backup_content | grep -ow db`" ] && DB_Remote_BK 
+  [ -n "`echo $backup_content | grep -ow db`" ] && DB_COS_BK
+  [ -n "`echo $backup_content | grep -ow web`" ] && WEB_Remote_BK 
+  [ -n "`echo $backup_content | grep -ow web`" ] && WEB_COS_BK
+  ./mabs.sh -c config_bakcup.txt -T -1 | tee mabs.log	
 fi

+ 71 - 19
backup_setup.sh

@@ -21,6 +21,7 @@ printf "
 . ./options.conf
 . ./include/color.sh
 . ./include/check_dir.sh
+. ./include/python.sh
 
 # Check if user is root
 [ $(id -u) != "0" ] && { echo "${CFAILURE}Error: You must be root to run this script${CEND}"; exit 1; }
@@ -29,11 +30,14 @@ while :; do echo
   echo 'Please select your backup destination:'
   echo -e "\t${CMSG}1${CEND}. Only Localhost"
   echo -e "\t${CMSG}2${CEND}. Only Remote host"
-  echo -e "\t${CMSG}3${CEND}. Localhost and Remote host"
+  echo -e "\t${CMSG}3${CEND}. Only Qcloud COS"
+  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
   [ -z "$DESC_BK" ] && DESC_BK=1
-  if [[ ! $DESC_BK =~ ^[1-3]$ ]]; then
-    echo "${CWARNING}input error! Please only input number 1,2,3${CEND}"
+  if [[ ! $DESC_BK =~ ^[1-6]$ ]]; then
+    echo "${CWARNING}input error! Please only input number 1,2,3,4,5,6${CEND}"
   else
     break
   fi
@@ -41,7 +45,10 @@ done
 
 [ "$DESC_BK" == '1' ] && sed -i 's@^backup_destination=.*@backup_destination=local@' ./options.conf
 [ "$DESC_BK" == '2' ] && sed -i 's@^backup_destination=.*@backup_destination=remote@' ./options.conf
-[ "$DESC_BK" == '3' ] && sed -i 's@^backup_destination=.*@backup_destination=local,remote@' ./options.conf
+[ "$DESC_BK" == '3' ] && sed -i 's@^backup_destination=.*@backup_destination=cos@' ./options.conf
+[ "$DESC_BK" == '4' ] && sed -i 's@^backup_destination=.*@backup_destination=local,remote@' ./options.conf
+[ "$DESC_BK" == '5' ] && sed -i 's@^backup_destination=.*@backup_destination=local,cos@' ./options.conf
+[ "$DESC_BK" == '6' ] && sed -i 's@^backup_destination=.*@backup_destination=Remote,cos@' ./options.conf
 
 while :; do echo
   echo 'Please select your backup content:'
@@ -61,17 +68,19 @@ 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
 
-while :; do echo
-  echo "Please enter the directory for save the backup file: "
-  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}"
-  else
-    break
-  fi
-done
-sed -i "s@^backup_dir=.*@backup_dir=$NEW_backup_dir@" ./options.conf
+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
+    [ -z "$NEW_backup_dir" ] && NEW_backup_dir="$backup_dir"
+    if [ -z "`echo $NEW_backup_dir| grep '^/'`" ]; then
+      echo "${CWARNING}input error! ${CEND}"
+    else
+      break
+    fi
+  done
+  sed -i "s@^backup_dir=.*@backup_dir=$NEW_backup_dir@" ./options.conf
+fi
 
 while :; do echo
   echo "Pleas enter a valid backup number of days: "
@@ -98,11 +107,11 @@ if [ "$CONTENT_BK" != '2' ]; then
   sed -i "s@^db_name=.*@db_name=$db_name@" ./options.conf
 fi
 
-if [ "$CONTENT_BK" != '1' ]; then
+if [ "$CONTENT_BK" != '1' ];then
   websites=`ls $wwwroot_dir | grep -vw default`
   while :; do echo
     echo "Please enter one or more name for website, separate multiple website names with commas: "
-    read -p "(Default website: `echo $websites | tr ' ' ','`) " website_name
+    read -p "(Default website: `echo $websites | tr ' ' ','`) " website_name 
     website_name=`echo $website_name | tr -d ' '`
     [ -z "$website_name" ] && website_name="`echo $websites | tr ' ' ','`"
     W_tmp=0
@@ -120,7 +129,7 @@ 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,3]$ ]]; then
+if [[ "$DESC_BK" =~ ^[2,4,6]$ ]]; then
   > tools/iplist.txt
   while :; do echo
     read -p "Please enter the remote host ip: " remote_ip
@@ -142,7 +151,7 @@ if [[ "$DESC_BK" =~ ^[2,3]$ ]]; 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,n]$ ]]; then
+        if [ "$more_host_yn" != 'y' -a "$more_host_yn" != 'n' ]; then
           echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}"
         else
           break
@@ -152,3 +161,46 @@ if [[ "$DESC_BK" =~ ^[2,3]$ ]]; then
     fi
   done
 fi
+
+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}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,2,3,4${CEND}"
+    fi
+  done
+  [ "$Location" == '1' ] && region=gz
+  [ "$Location" == '2' ] && region=tj
+  [ "$Location" == '3' ] && region=sh
+  [ "$Location" == '4' ] && region=sgp
+  while :; do echo
+    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
+    echo
+    read -p "Please enter the Qcloud COS secret key: " secret_key
+    [ -z "$secret_key" ] && continue
+    echo
+    read -p "Please enter the Qcloud COS bucket: " bucket 
+    [ -z "$bucket" ] && continue
+    echo
+    $python_install_dir/bin/python ./tools/coscmd config --appid=$appid --id=$secret_id --key=$secret_key --region=$region --bucket=$bucket >/dev/null 2>&1
+    if [ "`$python_install_dir/bin/python ./tools/coscmd ls /`" == 'True' ];then
+      echo "${CMSG}appid/secret_id/secret_key/region/bucket OK${CEND}"
+      echo
+      break
+    else
+      echo "${CWARNING}input error! appid/secret_id/secret_key/region/bucket invalid${CEND}"
+    fi
+  done
+fi

+ 3 - 3
include/check_sw.sh

@@ -26,10 +26,10 @@ installDepsDebian() {
   # Install needed packages
   case "${Debian_version}" in
     [6,7])
-      pkgList="gcc g++ make cmake autoconf libjpeg8 libjpeg8-dev libjpeg-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev libaio1 libaio-dev numactl libreadline-dev curl libcurl3 libcurl4-openssl-dev libcurl4-gnutls-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libssl-dev libtool libevent-dev bison re2c libsasl2-dev libxslt1-dev libicu-dev locales libcloog-ppl0 patch vim zip unzip tmux htop bc dc expect rsync git lsof lrzsz iptables rsyslog cron logrotate ntpdate libsqlite3-dev psmisc wget"
+      pkgList="gcc g++ make cmake autoconf libjpeg8 libjpeg8-dev libjpeg-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev libaio1 libaio-dev numactl libreadline-dev curl libcurl3 libcurl4-openssl-dev libcurl4-gnutls-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libssl-dev libtool libevent-dev bison re2c libsasl2-dev libxslt1-dev libicu-dev locales libcloog-ppl0 patch vim zip unzip tmux htop bc dc expect rsync git lsof lrzsz iptables rsyslog cron logrotate ntpdate libsqlite3-dev psmisc wget sysv-rc"
       ;;
     8)
-      pkgList="gcc g++ make cmake autoconf libjpeg8 libjpeg62-turbo-dev libjpeg-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev libaio1 libaio-dev numactl libreadline-dev curl libcurl3 libcurl4-openssl-dev libcurl4-gnutls-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libssl-dev libtool libevent-dev bison re2c libsasl2-dev libxslt1-dev libicu-dev locales libcloog-ppl0 patch vim zip unzip tmux htop bc dc expect rsync git lsof lrzsz iptables rsyslog cron logrotate ntpdate libsqlite3-dev psmisc wget"
+      pkgList="gcc g++ make cmake autoconf libjpeg8 libjpeg62-turbo-dev libjpeg-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev libaio1 libaio-dev numactl libreadline-dev curl libcurl3 libcurl4-openssl-dev libcurl4-gnutls-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libssl-dev libtool libevent-dev bison re2c libsasl2-dev libxslt1-dev libicu-dev locales libcloog-ppl0 patch vim zip unzip tmux htop bc dc expect rsync git lsof lrzsz iptables rsyslog cron logrotate ntpdate libsqlite3-dev psmisc wget sysv-rc"
       ;;
     *)
       echo "${CFAILURE}Your system Debian ${Debian_version} are not supported!${CEND}"
@@ -95,7 +95,7 @@ installDepsUbuntu() {
   apt-get -y upgrade -o Dir::Etc::SourceList=/tmp/security.sources.list
 
   # Install needed packages
-  pkgList="gcc g++ make cmake autoconf libjpeg8 libjpeg8-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev libaio1 libaio-dev numactl libreadline-dev curl libcurl3 libcurl4-openssl-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libssl-dev libtool libevent-dev re2c libsasl2-dev libxslt1-dev libicu-dev libsqlite3-dev patch vim zip unzip tmux htop bc dc expect iptables rsyslog rsync git lsof lrzsz ntpdate wget"
+  pkgList="gcc g++ make cmake autoconf libjpeg8 libjpeg8-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev libaio1 libaio-dev numactl libreadline-dev curl libcurl3 libcurl4-openssl-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libssl-dev libtool libevent-dev re2c libsasl2-dev libxslt1-dev libicu-dev libsqlite3-dev patch vim zip unzip tmux htop bc dc expect iptables rsyslog rsync git lsof lrzsz ntpdate wget sysv-rc"
   for Package in ${pkgList}; do
     apt-get -y install ${Package} --force-yes
   done

+ 2 - 0
include/openssl.sh

@@ -14,6 +14,7 @@ Install_openSSL102() {
     pushd ${oneinstack_dir}/src
     tar xzf openssl-${openssl_version}.tar.gz
     pushd openssl-${openssl_version}
+    make clean
     ./config --prefix=${openssl_install_dir} -fPIC shared zlib-dynamic
     make -j ${THREAD} && make install
     popd
@@ -33,6 +34,7 @@ Install_openSSL100() {
     pushd ${oneinstack_dir}/src
     tar xzf openssl-1.0.0s.tar.gz
     pushd openssl-1.0.0s
+    make clean
     ./config --prefix=/usr/local/openssl100s -fPIC shared zlib-dynamic
     make -j ${THREAD} && make install
     popd

+ 23 - 20
init.d/Nginx-init-CentOS

@@ -1,12 +1,13 @@
-#!/bin/sh
+#!/bin/bash
 #
 # nginx - this script starts and stops the nginx daemon
 #
 # chkconfig:   - 85 15
-# description:  Nginx is an HTTP(S) server, HTTP(S) reverse \
+# description:  NGINX is an HTTP(S) server, HTTP(S) reverse \
 #               proxy and IMAP/POP3 proxy server
 # processname: nginx
-# config:      /usr/local/nginx/conf/nginx.conf
+# config:      /etc/nginx/nginx.conf
+# config:      /etc/sysconfig/nginx
 # pidfile:     /var/run/nginx.pid
 
 # Source function library.
@@ -29,20 +30,22 @@ lockfile=/var/lock/subsys/nginx
 
 make_dirs() {
   # make required directories
-  user=`$nginx -V 2>&1 | grep "configure arguments:" | sed 's/[^*]*--user=\([^ ]*\).*/\1/g' -`
-  if [ -z "`grep $user /etc/passwd`" ]; then
-    useradd -M -s /bin/nologin $user
-  fi
-  options=`$nginx -V 2>&1 | grep 'configure arguments:'`
-  for opt in $options; do
-    if [ `echo $opt | grep '.*-temp-path'` ]; then
-      value=`echo $opt | cut -d "=" -f 2`
-      if [ ! -d "$value" ]; then
-        # echo "creating" $value
-        mkdir -p $value && chown -R $user $value
-      fi
+  user=`$nginx -V 2>&1 | grep "configure arguments:.*--user=" | sed 's/[^*]*--user=\([^ ]*\).*/\1/g' -`
+  if [ -n "$user" ]; then
+    if [ -z "`grep $user /etc/passwd`" ]; then
+      useradd -M -s /bin/nologin $user
     fi
-  done
+    options=`$nginx -V 2>&1 | grep 'configure arguments:'`
+    for opt in $options; do
+        if [ `echo $opt | grep '.*-temp-path'` ]; then
+          value=`echo $opt | cut -d "=" -f 2`
+          if [ ! -d "$value" ]; then
+            # echo "creating" $value
+            mkdir -p $value && chown -R $user $value
+          fi
+        fi
+    done
+  fi
 }
 
 start() {
@@ -59,7 +62,7 @@ start() {
 
 stop() {
   echo -n $"Stopping $prog: "
-  $nginx -s stop
+  killproc $prog -QUIT
   retval=$?
   echo
   [ $retval -eq 0 ] && rm -f $lockfile
@@ -69,14 +72,14 @@ stop() {
 restart() {
   configtest || return $?
   stop
-  sleep 3
+  sleep 1
   start
 }
 
 reload() {
   configtest || return $?
   echo -n $"Reloading $prog: "
-  $nginx -s reload
+  killproc $nginx -HUP
   RETVAL=$?
   echo
 }
@@ -123,6 +126,6 @@ case "$1" in
     rh_status_q || exit 0
     ;;
   *)
-    echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}"
+    echo $"Usage: $0 {start|stop|status|restart|reload|configtest}"
     exit 2
 esac

+ 0 - 3
reset_db_root_password.sh

@@ -22,9 +22,6 @@ printf "
 . ./include/color.sh
 . ./include/check_dir.sh
 
-# Check if user is root
-[ $(id -u) != "0" ] && { echo "${CFAILURE}Error: You must be root to run this script${CEND}"; exit 1; }
-
 Reset_db_root_password()
 {
   [ ! -d "$db_install_dir" ] && { echo "${CFAILURE}Database is not installed on your system! ${CEND}"; exit 1; }

+ 10 - 10
versions.txt

@@ -11,10 +11,10 @@ tomcat6_version=6.0.51
 
 apache24_version=2.4.25
 apache22_version=2.2.32
-pcre_version=8.39
+pcre_version=8.40
 apr_version=1.5.2
 apr_util_version=1.5.4
-nghttp2_version=1.18.1
+nghttp2_version=1.21.0
 
 # DB
 mysql57_version=5.7.17
@@ -25,9 +25,9 @@ mariadb101_version=10.1.22
 mariadb100_version=10.0.30
 mariadb55_version=5.5.54
 
-percona57_version=5.7.17-11
-percona56_version=5.6.35-80.0
-percona55_version=5.5.54-38.6
+percona57_version=5.7.17-12
+percona56_version=5.6.35-81.0
+percona55_version=5.5.54-38.7
 
 alisql56_version=5.6.32-4
 
@@ -48,13 +48,13 @@ zendopcache_version=7.0.5
 xcache_version=3.2.0
 apcu_version=4.0.11
 apcu_for_php7_version=5.1.8
-ImageMagick_version=6.9.8-2
+ImageMagick_version=6.9.8-3
 imagick_version=3.4.3
 imagick_for_php53_version=3.3.0
 GraphicsMagick_version=1.3.25
 gmagick_for_php7_version=2.0.4RC1
 gmagick_version=1.1.7RC3
-libiconv_version=1.14
+libiconv_version=1.15
 curl_version=7.53.1
 libmcrypt_version=2.5.8
 mcrypt_version=2.6.8
@@ -66,11 +66,11 @@ pureftpd_version=1.0.45
 
 # Redis
 redis_version=3.2.8
-redis_pecl_for_php7_version=3.1.1
+redis_pecl_for_php7_version=3.1.2
 redis_pecl_version=2.2.8
 
 # Memcached
-memcached_version=1.4.35
+memcached_version=1.4.36
 libmemcached_version=1.0.18
 memcached_pecl_version=2.2.0
 memcached_pecl_php7_version=3.0.3
@@ -86,7 +86,7 @@ jemalloc_version=4.5.0
 boost_version=1.59.0
 
 # Others
-libevent_version=2.0.22-stable
+libevent_version=2.1.8-stable
 tmux_version=2.3
 htop_version=2.0.2
 bison_version=2.7.1

+ 1 - 1
vhost.sh

@@ -571,9 +571,9 @@ server {
   server_name ${domain}${moredomainame};
   ${N_log}
   index index.html index.htm index.php;
-  include ${web_install_dir}/conf/rewrite/${rewrite}.conf;
   root ${vhostdir};
   ${Nginx_redirect}
+  include ${web_install_dir}/conf/rewrite/${rewrite}.conf;
   #error_page 404 = /404.html;
   #error_page 502 = /502.html;
   ${anti_hotlinking}