Browse Source

Optimization script file

lj2007331@gmail.com 6 years ago
parent
commit
bd353b7248

+ 8 - 8
addons.sh

@@ -161,7 +161,7 @@ EOF
 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
+  service fail2ban start
   popd > /dev/null
   if [ -e "${python_install_dir}/bin/fail2ban-python" ]; then
     echo; echo "${CSUCCESS}fail2ban installed successfully! ${CEND}"
@@ -172,7 +172,7 @@ EOF
 }
 
 Uninstall_fail2ban() {
-  /etc/init.d/fail2ban stop
+  service fail2ban stop
   ${python_install_dir}/bin/pip uninstall -y fail2ban > /dev/null 2>&1
   rm -rf /etc/init.d/fail2ban /etc/fail2ban /etc/logrotate.d/fail2ban /var/log/fail2ban.* /var/run/fail2ban
   echo; echo "${CMSG}fail2ban uninstall completed${CEND}";
@@ -185,7 +185,7 @@ ACTION_FUN() {
     echo -e "\t${CMSG}1${CEND}. install"
     echo -e "\t${CMSG}2${CEND}. uninstall"
     read -e -p "Please input a number:(Default 1 press Enter) " ACTION
-    [ -z "${ACTION}" ] && ACTION=1
+    ACTION=${ACTION:-1}
     if [[ ! "${ACTION}" =~ ^[1,2]$ ]]; then
       echo "${CWARNING}input error! Please only input number 1~2${CEND}"
     else
@@ -224,7 +224,7 @@ What Are You Doing?
           echo -e "\t${CMSG}3${CEND}. APCU"
           echo -e "\t${CMSG}4${CEND}. eAccelerator"
           read -e -p "Please input a number:(Default 1 press Enter) " phpcache_option
-          [ -z "${phpcache_option}" ] && phpcache_option=1
+          phpcache_option=${phpcache_option:-1}
           if [[ ! "${phpcache_option}" =~ ^[1-4]$ ]]; then
             echo "${CWARNING}input error! Please only input number 1~4${CEND}"
           else
@@ -304,7 +304,7 @@ What Are You Doing?
           echo -e "\t${CMSG}2${CEND}. ionCube Loader"
           echo -e "\t${CMSG}3${CEND}. SourceGuardian"
           read -e -p "Please input a number:(Default 1 press Enter) " Loader
-          [ -z "${Loader}" ] && Loader=1
+          Loader=${Loader:-1}
           if [[ ! "${Loader}" =~ ^[1-3]$ ]]; then
             echo "${CWARNING}input error! Please only input number 1~3${CEND}"
           else
@@ -352,7 +352,7 @@ What Are You Doing?
           echo -e "\t${CMSG}1${CEND}. ImageMagick"
           echo -e "\t${CMSG}2${CEND}. GraphicsMagick"
           read -e -p "Please input a number:(Default 1 press Enter) " magick_option
-          [ -z "${magick_option}" ] && magick_option=1
+          magick_option=${magick_option:-1}
           if [[ ! "${magick_option}" =~ ^[1,2]$ ]]; then
             echo "${CWARNING}input error! Please only input number 1~2${CEND}"
           else
@@ -388,7 +388,7 @@ What Are You Doing?
           echo -e "\t${CMSG}3${CEND}. phalcon"
           echo -e "\t${CMSG}4${CEND}. mongodb"
           read -e -p "Please input a number:(Default 1 press Enter) " phpext_option
-          [ -z "${phpext_option}" ] && phpext_option=1
+          phpext_option=${phpext_option:-1}
           if [[ ! "${phpext_option}" =~ ^[1-4]$ ]]; then
             echo "${CWARNING}input error! Please only input number 1~4${CEND}"
           else
@@ -465,7 +465,7 @@ What Are You Doing?
           echo -e "\t${CMSG}2${CEND}. memcached PHP Extension"
           echo -e "\t${CMSG}3${CEND}. memcache/memcached PHP Extension"
           read -e -p "Please input a number:(Default 1 press Enter) " Memcache
-          [ -z "${Memcache}" ] && Memcache=1
+          Memcache=${Memcache:-1}
           if [[ ! "${Memcache}" =~ ^[1-3]$ ]]; then
             echo "${CWARNING}input error! Please only input number 1~3${CEND}"
           else

+ 63 - 50
backup_setup.sh

@@ -39,7 +39,7 @@ while :; do echo
   echo -e "\t${CMSG}5${CEND}. UPYUN"
   echo -e "\t${CMSG}6${CEND}. QINIU"
   read -e -p "Please input a number:(Default 1 press Enter) " desc_bk
-  [ -z "${desc_bk}" ] && desc_bk=1
+  desc_bk=${desc_bk:-1}
   ary=(1 2 3 4 5 6 12 13 14 15 16 23 24 25 26 34 35 36 45 46 56 123 124 125 126 134 135 136 145 146 156 234 235 236 245 246 256 345 346 456 1234 1235 1236 2345 2346 3456 12345 12346 13456 23456 123456)
   if [[ "${ary[@]}" =~ "${desc_bk}" ]]; then
     break
@@ -63,7 +63,7 @@ while :; do echo
   echo -e "\t${CMSG}2${CEND}. Only Website"
   echo -e "\t${CMSG}3${CEND}. Database and Website"
   read -e -p "Please input a number:(Default 1 press Enter) " content_bk
-  [ -z "${content_bk}" ] && content_bk=1
+  content_bk=${content_bk:-1}
   if [[ ! ${content_bk} =~ ^[1-3]$ ]]; then
     echo "${CWARNING}input error! Please only input number 1~3${CEND}"
   else
@@ -79,7 +79,7 @@ if [[ ${desc_bk} =~ ^[1,2]$ ]]; then
   while :; do echo
     echo "Please enter the directory for save the backup file: "
     read -e -p "(Default directory: ${backup_dir}): " new_backup_dir
-    [ -z "${new_backup_dir}" ] && new_backup_dir="${backup_dir}"
+    new_backup_dir=${new_backup_dir:-${backup_dir}}
     if [ -z "`echo ${new_backup_dir}| grep '^/'`" ]; then
       echo "${CWARNING}input error! ${CEND}"
     else
@@ -92,7 +92,7 @@ fi
 while :; do echo
   echo "Please enter a valid backup number of days: "
   read -e -p "(Default days: 5): " expired_days
-  [ -z "${expired_days}" ] && expired_days=5
+  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
@@ -143,10 +143,10 @@ if [ `echo ${desc_bk} | grep -e 2` ]; then
     [ -z "${remote_ip}" -o "${remote_ip}" == '127.0.0.1' ] && continue
     echo
     read -e -p "Please enter the remote host port(Default: 22) : " remote_port
-    [ -z "${remote_port}" ] && remote_port=22
+    remote_port=${remote_port:-22}
     echo
     read -e -p "Please enter the remote host user(Default: root) : " remote_user
-    [ -z "${remote_user}" ] && remote_user=root
+    remote_user=${remote_user:-root}
     echo
     read -e -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')
@@ -186,7 +186,7 @@ if [ `echo ${desc_bk} | grep -e 3` ]; then
     echo -e "\t${CMSG}15${CEND}. ap-northeast-亚太东北 1 (日本)   ${CMSG}16${CEND}. ap-south-亚太南部 1 (孟买)"
     echo -e "\t${CMSG}17${CEND}. eu-central-欧洲中部 1 (法兰克福) ${CMSG}18${CEND}. me-east-中东东部 1 (迪拜)"
     read -e -p "Please input a number:(Default 1 press Enter) " Location
-    [ -z "${Location}" ] && Location=1
+    Location=${Location:-1}
     if [[ "${Location}" =~ ^[1-9]$|^1[0-8]$ ]]; then
       break
     else
@@ -247,51 +247,64 @@ if [ `echo ${desc_bk} | grep -e 4` ]; then
     echo -e "\t ${CMSG}15${CEND}. ap-bangkok-曼谷             ${CMSG}16${CEND}. eu-moscow-莫斯科"
     echo -e "\t ${CMSG}17${CEND}. ap-tokyo-东京"
     read -e -p "Please input a number:(Default 1 press Enter) " Location
-    [ -z "${Location}" ] && Location=1
+    Location=${Location:-1}
     if [[ "${Location}" =~ ^[1-9]$|^1[0-7]$ ]]; then
       break
     else
       echo "${CWARNING}input error! Please only input number 1~17${CEND}"
     fi
   done
-  [ "${Location}" == '1' ] && region='ap-beijing-1'
-  [ "${Location}" == '2' ] && region='ap-beijing'
-  [ "${Location}" == '3' ] && region='ap-shanghai'
-  [ "${Location}" == '4' ] && region='ap-guangzhou'
-  [ "${Location}" == '5' ] && region='ap-chengdu'
-  [ "${Location}" == '6' ] && region='ap-chongqing'
-  [ "${Location}" == '7' ] && region='ap-singapore'
-  [ "${Location}" == '8' ] && region='ap-hongkong'
-  [ "${Location}" == '9' ] && region='na-toronto'
-  [ "${Location}" == '10' ] && region='eu-frankfurt'
-  [ "${Location}" == '11' ] && region='ap-mumbai'
-  [ "${Location}" == '12' ] && region='ap-seoul'
-  [ "${Location}" == '13' ] && region='na-siliconvalley'
-  [ "${Location}" == '14' ] && region='na-ashburn'
-  [ "${Location}" == '15' ] && region='ap-bangkok'
-  [ "${Location}" == '16' ] && region='eu-moscow'
-  [ "${Location}" == '17' ] && region='ap-tokyo'
+  [ "${Location}" == '1' ] && REGION='ap-beijing-1'
+  [ "${Location}" == '2' ] && REGION='ap-beijing'
+  [ "${Location}" == '3' ] && REGION='ap-shanghai'
+  [ "${Location}" == '4' ] && REGION='ap-guangzhou'
+  [ "${Location}" == '5' ] && REGION='ap-chengdu'
+  [ "${Location}" == '6' ] && REGION='ap-chongqing'
+  [ "${Location}" == '7' ] && REGION='ap-singapore'
+  [ "${Location}" == '8' ] && REGION='ap-hongkong'
+  [ "${Location}" == '9' ] && REGION='na-toronto'
+  [ "${Location}" == '10' ] && REGION='eu-frankfurt'
+  [ "${Location}" == '11' ] && REGION='ap-mumbai'
+  [ "${Location}" == '12' ] && REGION='ap-seoul'
+  [ "${Location}" == '13' ] && REGION='na-siliconvalley'
+  [ "${Location}" == '14' ] && REGION='na-ashburn'
+  [ "${Location}" == '15' ] && REGION='ap-bangkok'
+  [ "${Location}" == '16' ] && REGION='eu-moscow'
+  [ "${Location}" == '17' ] && REGION='ap-tokyo'
   while :; do echo
     read -e -p "Please enter the Qcloud COS APPID: " APPID
-    [ -z "${APPID}" ] && continue
+    [[ ! "${APPID}" =~ ^[0-9]+$ ]] && { echo "${CWARNING}input error, must be a number${CEND}"; continue; }
     echo
-    read -e -p "Please enter the Qcloud COS SecretId: " SecretId
-    [ -z "${SecretId}" ] && continue
+    read -e -p "Please enter the Qcloud COS SECRET_ID: " SECRET_ID
+    [ -z "${SECRET_ID}" ] && continue
     echo
-    read -e -p "Please enter the Qcloud COS SecretKey: " SecretKey
-    [ -z "$SecretKey" ] && continue
+    read -e -p "Please enter the Qcloud COS SECRET_KEY: " SECRET_KEY
+    [ -z "${SECRET_KEY}" ] && continue
     echo
-    read -e -p "Please enter the Qcloud COS bucket: " bucket
-    [ -z "${bucket}" ] && continue
-    echo
-    ${python_install_dir}/bin/coscmd config -u ${APPID} -a ${SecretId} -s $SecretKey -r $region -b ${bucket} >/dev/null 2>&1
+    read -e -p "Please enter the Qcloud COS BUCKET: " BUCKET
+    if [[ ${BUCKET} =~ "-${APPID}"$ ]]; then 
+      Bucket=${BUCKET}
+    else
+      [ -z "${BUCKET}" ] && continue
+      echo
+      Bucket=${BUCKET}-${APPID}
+    fi
+    ${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 list >/dev/null 2>&1
-    if [ $? = 0 ]; then
-      echo "${CMSG}APPID/SecretId/SecretKey/region/bucket OK${CEND}"
+    if [ $? -eq 0 ];then
+      echo "${CMSG}APPID/SECRET_ID/SECRET_KEY/REGION/BUCKET OK${CEND}"
       echo
       break
     else
-      echo "${CWARNING}input error! APPID/SecretId/SecretKey/region/bucket invalid${CEND}"
+      ${python_install_dir}/bin/coscmd -b ${Bucket} createbucket >/dev/null 2>&1
+      if [ $? -eq 0 ];then
+        echo "${CMSG}APPID/SECRET_ID/SECRET_KEY/REGION OK, You createbucket ${Bucket}${CEND}"
+        echo
+        break
+      else
+        echo "${CWARNING}input error! APPID/SECRET_ID/SECRET_KEY/REGION/BUCKET invalid${CEND}"
+        continue
+      fi
     fi
   done
 fi
@@ -350,9 +363,9 @@ if [ `echo ${desc_bk} | grep -e 6` ]; then
     echo 'Please select your backup qiniu datacenter:'
     echo -e "\t ${CMSG} 1${CEND}. 华东            ${CMSG}2${CEND}. 华北"
     echo -e "\t ${CMSG} 3${CEND}. 华南            ${CMSG}4${CEND}. 北美"
-    echo -e "\t ${CMSG} 5${CEND}. 东南亚" 
+    echo -e "\t ${CMSG} 5${CEND}. 东南亚"
     read -e -p "Please input a number:(Default 1 press Enter) " Location
-    [ -z "${Location}" ] && Location=1
+    Location=${Location:-1}
     if [[ "${Location}" =~ ^[1-5]$ ]]; then
       break
     else
@@ -365,30 +378,30 @@ if [ `echo ${desc_bk} | grep -e 6` ]; then
   [ "${Location}" == '4' ] && zone='na0'
   [ "${Location}" == '5' ] && zone='as0'
   while :; do echo
-    read -e -p "Please enter the qiniu AccessKey: " AccessKey 
+    read -e -p "Please enter the qiniu AccessKey: " AccessKey
     [ -z "${AccessKey}" ] && continue
     echo
-    read -e -p "Please enter the qiniu SecretKey: " SecretKey 
+    read -e -p "Please enter the qiniu SecretKey: " SecretKey
     [ -z "${SecretKey}" ] && continue
     echo
-    read -e -p "Please enter the qiniu bucket: " bucket
-    [ -z "${bucket}" ] && continue
+    read -e -p "Please enter the qiniu bucket: " Bucket
+    [ -z "${Bucket}" ] && continue
     echo
     /usr/local/bin/qshell account ${AccessKey} ${SecretKey}
     /usr/local/bin/qrsctl login ${AccessKey} ${SecretKey}
-    if /usr/local/bin/qrsctl bucketinfo ${bucket} > /dev/null 2>&1; then
-      sed -i "s@^qiniu_bucket=.*@qiniu_bucket=${bucket}@" ./options.conf
+    if /usr/local/bin/qrsctl bucketinfo ${Bucket} > /dev/null 2>&1; then
+      sed -i "s@^qiniu_bucket=.*@qiniu_bucket=${Bucket}@" ./options.conf
       echo "${CMSG}AccessKey/SecretKey OK${CEND}"
       echo
       break
-    elif /usr/local/bin/qrsctl mkbucket ${bucket} ${zone} > /dev/null 2>&1; then
-      /usr/local/bin/qrsctl private ${bucket} 1
-      echo "${CMSG}[${bucket}] createbucket OK${CEND}"
-      sed -i "s@^qiniu_bucket=.*@qiniu_bucket=${bucket}@" ./options.conf
+    elif /usr/local/bin/qrsctl mkbucket ${Bucket} ${zone} > /dev/null 2>&1; then
+      /usr/local/bin/qrsctl private ${Bucket} 1
+      echo "${CMSG}[${Bucket}] createbucket OK${CEND}"
+      sed -i "s@^qiniu_bucket=.*@qiniu_bucket=${Bucket}@" ./options.conf
       echo "${CMSG}AccessKey/SecretKey OK${CEND}"
       echo
       break
-    else 
+    else
       echo "${CWARNING}input error! AccessKey/SecretKey invalid${CEND}"
     fi
   done

+ 1 - 1
include/check_download.sh

@@ -792,7 +792,7 @@ checkDownload() {
       # src_url=https://codeload.github.com/websupport-sk/pecl-memcache/zip/php7 && Download_src
       src_url=${mirrorLink}/pecl-memcache-php7.tgz && Download_src
       echo "Download pecl_memcached for php 7.x..."
-      src_url=https://pecl.php.net/get/memcached-${pecl_memcached_php7_ver}.tgz && Download_src
+      src_url=${mirrorLink}/memcached-${pecl_memcached_php7_ver}.tgz && Download_src
     fi
 
     echo "Download libmemcached..."

+ 16 - 7
include/php-5.3.sh

@@ -10,6 +10,10 @@
 
 Install_PHP53() {
   pushd ${oneinstack_dir}/src > /dev/null
+  if [ -e "${apache_install_dir}/bin/apachectl" ];then
+    [ "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '4' ] && Apache_flag=24
+    [ "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '2' ] && Apache_flag=22
+  fi
   if [ ! -e "/usr/local/lib/libiconv.la" ]; then
     tar xzf libiconv-${libiconv_ver}.tar.gz
     patch -d libiconv-${libiconv_ver} -p0 < libiconv-glibc-2.16.patch
@@ -87,7 +91,7 @@ Install_PHP53() {
   patch -p1 < ../debian_patches_disable_SSLv2_for_openssl_1_0_0.patch
   make clean
   [ ! -d "${php_install_dir}" ] && mkdir -p ${php_install_dir}
-  if [ "${apache_option}" == '2' ] || [ "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '2' ]; then
+  if [ "${apache_option}" == '2' ] || [ "${Apache_flag}" == '22' ]; then
     ./configure --prefix=${php_install_dir} --with-config-file-path=${php_install_dir}/etc \
     --with-config-file-scan-dir=${php_install_dir}/etc/php.d \
     --with-apxs2=${apache_install_dir}/bin/apxs --disable-fileinfo \
@@ -145,12 +149,17 @@ Install_PHP53() {
   sed -i 's@^disable_functions.*@disable_functions = passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,fsocket,popen@' ${php_install_dir}/etc/php.ini
   [ -e /usr/sbin/sendmail ] && sed -i 's@^;sendmail_path.*@sendmail_path = /usr/sbin/sendmail -t -i@' ${php_install_dir}/etc/php.ini
 
-  if [ ! -e "${apache_install_dir}/bin/apxs" -o "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '4' ]; then
+  if [ ! -e "${apache_install_dir}/bin/apxs" -o "${Apache_flag}" == '24' ]; then
     # php-fpm Init Script
-    /bin/cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
-    chmod +x /etc/init.d/php-fpm
-    [ "${PM}" == 'yum' ] && { chkconfig --add php-fpm; chkconfig php-fpm on; }
-    [ "${PM}" == 'apt-get' ] && update-rc.d php-fpm defaults
+    if [ -e /bin/systemctl ]; then
+      /bin/cp sapi/fpm/php-fpm.service /lib/systemd/system/
+      systemctl enable php-fpm
+    else
+      /bin/cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
+      chmod +x /etc/init.d/php-fpm
+      [ "${PM}" == 'yum' ] && { chkconfig --add php-fpm; chkconfig php-fpm on; }
+      [ "${PM}" == 'apt-get' ] && update-rc.d php-fpm defaults
+    fi
 
     cat > ${php_install_dir}/etc/php-fpm.conf <<EOF
 ;;;;;;;;;;;;;;;;;;;;;
@@ -238,7 +247,7 @@ EOF
     #[ "$web_yn" == 'n' ] && sed -i "s@^listen =.*@listen = $IPADDR:9000@" ${php_install_dir}/etc/php-fpm.conf
     service php-fpm start
 
-  elif [ "${apache_option}" == '2' ] || [ "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '2' ]; then
+  elif [ "${apache_option}" == '2' ] || [ "${Apache_flag}" == '22' ]; then
     service httpd restart
   fi
   popd > /dev/null

+ 16 - 7
include/php-5.4.sh

@@ -10,6 +10,10 @@
 
 Install_PHP54() {
   pushd ${oneinstack_dir}/src > /dev/null
+  if [ -e "${apache_install_dir}/bin/apachectl" ];then
+    [ "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '4' ] && Apache_flag=24
+    [ "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '2' ] && Apache_flag=22
+  fi
   if [ ! -e "/usr/local/lib/libiconv.la" ]; then
     tar xzf libiconv-${libiconv_ver}.tar.gz
     patch -d libiconv-${libiconv_ver} -p0 < libiconv-glibc-2.16.patch
@@ -83,7 +87,7 @@ Install_PHP54() {
   pushd php-${php54_ver} > /dev/null
   make clean
   [ ! -d "${php_install_dir}" ] && mkdir -p ${php_install_dir}
-  if [ "${apache_option}" == '2' ] || [ "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '2' ]; then
+  if [ "${apache_option}" == '2' ] || [ "${Apache_flag}" == '22' ]; then
     ./configure --prefix=${php_install_dir} --with-config-file-path=${php_install_dir}/etc \
     --with-config-file-scan-dir=${php_install_dir}/etc/php.d \
     --with-apxs2=${apache_install_dir}/bin/apxs --disable-fileinfo \
@@ -140,12 +144,17 @@ Install_PHP54() {
   sed -i 's@^disable_functions.*@disable_functions = passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,fsocket,popen@' ${php_install_dir}/etc/php.ini
   [ -e /usr/sbin/sendmail ] && sed -i 's@^;sendmail_path.*@sendmail_path = /usr/sbin/sendmail -t -i@' ${php_install_dir}/etc/php.ini
 
-  if [ ! -e "${apache_install_dir}/bin/apxs" -o "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '4' ]; then
+  if [ ! -e "${apache_install_dir}/bin/apxs" -o "${Apache_flag}" == '24' ]; then
     # php-fpm Init Script
-    /bin/cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
-    chmod +x /etc/init.d/php-fpm
-    [ "${PM}" == 'yum' ] && { chkconfig --add php-fpm; chkconfig php-fpm on; }
-    [ "${PM}" == 'apt-get' ] && update-rc.d php-fpm defaults
+    if [ -e /bin/systemctl ]; then
+      /bin/cp sapi/fpm/php-fpm.service /lib/systemd/system/
+      systemctl enable php-fpm
+    else
+      /bin/cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
+      chmod +x /etc/init.d/php-fpm
+      [ "${PM}" == 'yum' ] && { chkconfig --add php-fpm; chkconfig php-fpm on; }
+      [ "${PM}" == 'apt-get' ] && update-rc.d php-fpm defaults
+    fi
 
     cat > ${php_install_dir}/etc/php-fpm.conf <<EOF
 ;;;;;;;;;;;;;;;;;;;;;
@@ -233,7 +242,7 @@ EOF
     #[ "$web_yn" == 'n' ] && sed -i "s@^listen =.*@listen = $IPADDR:9000@" ${php_install_dir}/etc/php-fpm.conf
     service php-fpm start
 
-  elif [ "${apache_option}" == '2' ] || [ "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '2' ]; then
+  elif [ "${apache_option}" == '2' ] || [ "${Apache_flag}" == '22' ]; then
     service httpd restart
   fi
   popd > /dev/null

+ 16 - 7
include/php-5.5.sh

@@ -10,6 +10,10 @@
 
 Install_PHP55() {
   pushd ${oneinstack_dir}/src > /dev/null
+  if [ -e "${apache_install_dir}/bin/apachectl" ];then
+    [ "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '4' ] && Apache_flag=24
+    [ "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '2' ] && Apache_flag=22
+  fi
   if [ ! -e "/usr/local/lib/libiconv.la" ]; then
     tar xzf libiconv-${libiconv_ver}.tar.gz
     patch -d libiconv-${libiconv_ver} -p0 < libiconv-glibc-2.16.patch
@@ -82,7 +86,7 @@ Install_PHP55() {
   pushd php-${php55_ver} > /dev/null
   [ ! -d "${php_install_dir}" ] && mkdir -p ${php_install_dir}
   [ "${phpcache_option}" == '1' ] && phpcache_arg='--enable-opcache' || phpcache_arg='--disable-opcache'
-  if [ "${apache_option}" == '2' ] || [ "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '2' ]; then
+  if [ "${apache_option}" == '2' ] || [ "${Apache_flag}" == '22' ]; then
     ./configure --prefix=${php_install_dir} --with-config-file-path=${php_install_dir}/etc \
     --with-config-file-scan-dir=${php_install_dir}/etc/php.d \
     --with-apxs2=${apache_install_dir}/bin/apxs ${phpcache_arg} --disable-fileinfo \
@@ -153,12 +157,17 @@ opcache.enable_cli=1
 ;opcache.optimization_level=0
 EOF
 
-  if [ ! -e "${apache_install_dir}/bin/apxs" -o "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '4' ]; then
+  if [ ! -e "${apache_install_dir}/bin/apxs" -o "${Apache_flag}" == '24' ]; then
     # php-fpm Init Script
-    /bin/cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
-    chmod +x /etc/init.d/php-fpm
-    [ "${PM}" == 'yum' ] && { chkconfig --add php-fpm; chkconfig php-fpm on; }
-    [ "${PM}" == 'apt-get' ] && update-rc.d php-fpm defaults
+    if [ -e /bin/systemctl ]; then
+      /bin/cp sapi/fpm/php-fpm.service /lib/systemd/system/
+      systemctl enable php-fpm
+    else
+      /bin/cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
+      chmod +x /etc/init.d/php-fpm
+      [ "${PM}" == 'yum' ] && { chkconfig --add php-fpm; chkconfig php-fpm on; }
+      [ "${PM}" == 'apt-get' ] && update-rc.d php-fpm defaults
+    fi
 
     cat > ${php_install_dir}/etc/php-fpm.conf <<EOF
 ;;;;;;;;;;;;;;;;;;;;;
@@ -246,7 +255,7 @@ EOF
     #[ "$web_yn" == 'n' ] && sed -i "s@^listen =.*@listen = $IPADDR:9000@" ${php_install_dir}/etc/php-fpm.conf
     service php-fpm start
 
-  elif [ "${apache_option}" == '2' ] || [ "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '2' ]; then
+  elif [ "${apache_option}" == '2' ] || [ "${Apache_flag}" == '22' ]; then
     service httpd restart
   fi
   popd > /dev/null

+ 16 - 7
include/php-5.6.sh

@@ -10,6 +10,10 @@
 
 Install_PHP56() {
   pushd ${oneinstack_dir}/src > /dev/null
+  if [ -e "${apache_install_dir}/bin/apachectl" ];then
+    [ "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '4' ] && Apache_flag=24
+    [ "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '2' ] && Apache_flag=22
+  fi
   if [ ! -e "/usr/local/lib/libiconv.la" ]; then
     tar xzf libiconv-${libiconv_ver}.tar.gz
     patch -d libiconv-${libiconv_ver} -p0 < libiconv-glibc-2.16.patch
@@ -83,7 +87,7 @@ Install_PHP56() {
   make clean
   [ ! -d "${php_install_dir}" ] && mkdir -p ${php_install_dir}
   [ "${phpcache_option}" == '1' ] && phpcache_arg='--enable-opcache' || phpcache_arg='--disable-opcache'
-  if [ "${apache_option}" == '2' ] || [ "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '2' ]; then
+  if [ "${apache_option}" == '2' ] || [ "${Apache_flag}" == '22' ]; then
     ./configure --prefix=${php_install_dir} --with-config-file-path=${php_install_dir}/etc \
     --with-config-file-scan-dir=${php_install_dir}/etc/php.d \
     --with-apxs2=${apache_install_dir}/bin/apxs ${phpcache_arg} --disable-fileinfo \
@@ -156,12 +160,17 @@ opcache.enable_cli=1
 ;opcache.optimization_level=0
 EOF
 
-  if [ ! -e "${apache_install_dir}/bin/apxs" -o "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '4' ]; then
+  if [ ! -e "${apache_install_dir}/bin/apxs" -o "${Apache_flag}" == '24' ]; then
     # php-fpm Init Script
-    /bin/cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
-    chmod +x /etc/init.d/php-fpm
-    [ "${PM}" == 'yum' ] && { chkconfig --add php-fpm; chkconfig php-fpm on; }
-    [ "${PM}" == 'apt-get' ] && update-rc.d php-fpm defaults
+    if [ -e /bin/systemctl ]; then
+      /bin/cp sapi/fpm/php-fpm.service /lib/systemd/system/
+      systemctl enable php-fpm
+    else
+      /bin/cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
+      chmod +x /etc/init.d/php-fpm
+      [ "${PM}" == 'yum' ] && { chkconfig --add php-fpm; chkconfig php-fpm on; }
+      [ "${PM}" == 'apt-get' ] && update-rc.d php-fpm defaults
+    fi
 
     cat > ${php_install_dir}/etc/php-fpm.conf <<EOF
 ;;;;;;;;;;;;;;;;;;;;;
@@ -249,7 +258,7 @@ EOF
     #[ "$web_yn" == 'n' ] && sed -i "s@^listen =.*@listen = $IPADDR:9000@" ${php_install_dir}/etc/php-fpm.conf
     service php-fpm start
 
-  elif [ "${apache_option}" == '2' ] || [ "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '2' ]; then
+  elif [ "${apache_option}" == '2' ] || [ "${Apache_flag}" == '22' ]; then
     service httpd restart
   fi
   popd > /dev/null

+ 16 - 7
include/php-7.0.sh

@@ -10,6 +10,10 @@
 
 Install_PHP70() {
   pushd ${oneinstack_dir}/src > /dev/null
+  if [ -e "${apache_install_dir}/bin/apachectl" ];then
+    [ "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '4' ] && Apache_flag=24
+    [ "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '2' ] && Apache_flag=22
+  fi
   if [ ! -e "/usr/local/lib/libiconv.la" ]; then
     tar xzf libiconv-${libiconv_ver}.tar.gz
     patch -d libiconv-${libiconv_ver} -p0 < libiconv-glibc-2.16.patch
@@ -84,7 +88,7 @@ Install_PHP70() {
   ./buildconf
   [ ! -d "${php_install_dir}" ] && mkdir -p ${php_install_dir}
   [ "${phpcache_option}" == '1' ] && phpcache_arg='--enable-opcache' || phpcache_arg='--disable-opcache'
-  if [ "${apache_option}" == '2' ] || [ "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '2' ]; then
+  if [ "${apache_option}" == '2' ] || [ "${Apache_flag}" == '22' ]; then
     ./configure --prefix=${php_install_dir} --with-config-file-path=${php_install_dir}/etc \
     --with-config-file-scan-dir=${php_install_dir}/etc/php.d \
     --with-apxs2=${apache_install_dir}/bin/apxs ${phpcache_arg} --disable-fileinfo \
@@ -162,12 +166,17 @@ opcache.consistency_checks=0
 ;opcache.optimization_level=0
 EOF
 
-  if [ ! -e "${apache_install_dir}/bin/apxs" -o "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '4' ]; then
+  if [ ! -e "${apache_install_dir}/bin/apxs" -o "${Apache_flag}" == '24' ]; then
     # php-fpm Init Script
-    /bin/cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
-    chmod +x /etc/init.d/php-fpm
-    [ "${PM}" == 'yum' ] && { chkconfig --add php-fpm; chkconfig php-fpm on; }
-    [ "${PM}" == 'apt-get' ] && update-rc.d php-fpm defaults
+    if [ -e /bin/systemctl ]; then
+      /bin/cp sapi/fpm/php-fpm.service /lib/systemd/system/
+      systemctl enable php-fpm
+    else
+      /bin/cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
+      chmod +x /etc/init.d/php-fpm
+      [ "${PM}" == 'yum' ] && { chkconfig --add php-fpm; chkconfig php-fpm on; }
+      [ "${PM}" == 'apt-get' ] && update-rc.d php-fpm defaults
+    fi
 
     cat > ${php_install_dir}/etc/php-fpm.conf <<EOF
 ;;;;;;;;;;;;;;;;;;;;;
@@ -255,7 +264,7 @@ EOF
     #[ "$web_yn" == 'n' ] && sed -i "s@^listen =.*@listen = $IPADDR:9000@" ${php_install_dir}/etc/php-fpm.conf
     service php-fpm start
 
-  elif [ "${apache_option}" == '2' ] || [ "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '2' ]; then
+  elif [ "${apache_option}" == '2' ] || [ "${Apache_flag}" == '22' ]; then
     service httpd restart
   fi
   popd > /dev/null

+ 16 - 7
include/php-7.1.sh

@@ -10,6 +10,10 @@
 
 Install_PHP71() {
   pushd ${oneinstack_dir}/src > /dev/null
+  if [ -e "${apache_install_dir}/bin/apachectl" ];then
+    [ "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '4' ] && Apache_flag=24
+    [ "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '2' ] && Apache_flag=22
+  fi
   if [ ! -e "/usr/local/lib/libiconv.la" ]; then
     tar xzf libiconv-${libiconv_ver}.tar.gz
     patch -d libiconv-${libiconv_ver} -p0 < libiconv-glibc-2.16.patch
@@ -84,7 +88,7 @@ Install_PHP71() {
   ./buildconf
   [ ! -d "${php_install_dir}" ] && mkdir -p ${php_install_dir}
   [ "${phpcache_option}" == '1' ] && phpcache_arg='--enable-opcache' || phpcache_arg='--disable-opcache'
-  if [ "${apache_option}" == '2' ] || [ "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '2' ]; then
+  if [ "${apache_option}" == '2' ] || [ "${Apache_flag}" == '22' ]; then
     ./configure --prefix=${php_install_dir} --with-config-file-path=${php_install_dir}/etc \
     --with-config-file-scan-dir=${php_install_dir}/etc/php.d \
     --with-apxs2=${apache_install_dir}/bin/apxs ${phpcache_arg} --disable-fileinfo \
@@ -162,12 +166,17 @@ opcache.consistency_checks=0
 ;opcache.optimization_level=0
 EOF
 
-  if [ ! -e "${apache_install_dir}/bin/apxs" -o "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '4' ]; then
+  if [ ! -e "${apache_install_dir}/bin/apxs" -o "${Apache_flag}" == '24' ]; then
     # php-fpm Init Script
-    /bin/cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
-    chmod +x /etc/init.d/php-fpm
-    [ "${PM}" == 'yum' ] && { chkconfig --add php-fpm; chkconfig php-fpm on; }
-    [ "${PM}" == 'apt-get' ] && update-rc.d php-fpm defaults
+    if [ -e /bin/systemctl ]; then
+      /bin/cp sapi/fpm/php-fpm.service /lib/systemd/system/
+      systemctl enable php-fpm
+    else
+      /bin/cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
+      chmod +x /etc/init.d/php-fpm
+      [ "${PM}" == 'yum' ] && { chkconfig --add php-fpm; chkconfig php-fpm on; }
+      [ "${PM}" == 'apt-get' ] && update-rc.d php-fpm defaults
+    fi
 
     cat > ${php_install_dir}/etc/php-fpm.conf <<EOF
 ;;;;;;;;;;;;;;;;;;;;;
@@ -255,7 +264,7 @@ EOF
     #[ "$web_yn" == 'n' ] && sed -i "s@^listen =.*@listen = $IPADDR:9000@" ${php_install_dir}/etc/php-fpm.conf
     service php-fpm start
 
-  elif [ "${apache_option}" == '2' ] || [ "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '2' ]; then
+  elif [ "${apache_option}" == '2' ] || [ "${Apache_flag}" == '22' ]; then
     service httpd restart
   fi
   popd > /dev/null

+ 16 - 7
include/php-7.2.sh

@@ -10,6 +10,10 @@
 
 Install_PHP72() {
   pushd ${oneinstack_dir}/src > /dev/null
+  if [ -e "${apache_install_dir}/bin/apachectl" ];then
+    [ "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '4' ] && Apache_flag=24
+    [ "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '2' ] && Apache_flag=22
+  fi
   if [ ! -e "/usr/local/lib/libiconv.la" ]; then
     tar xzf libiconv-${libiconv_ver}.tar.gz
     patch -d libiconv-${libiconv_ver} -p0 < libiconv-glibc-2.16.patch
@@ -78,7 +82,7 @@ Install_PHP72() {
   ./buildconf
   [ ! -d "${php_install_dir}" ] && mkdir -p ${php_install_dir}
   [ "${phpcache_option}" == '1' ] && phpcache_arg='--enable-opcache' || phpcache_arg='--disable-opcache'
-  if [ "${apache_option}" == '2' ] || [ "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '2' ]; then
+  if [ "${apache_option}" == '2' ] || [ "${Apache_flag}" == '22' ]; then
     ./configure --prefix=${php_install_dir} --with-config-file-path=${php_install_dir}/etc \
     --with-config-file-scan-dir=${php_install_dir}/etc/php.d \
     --with-apxs2=${apache_install_dir}/bin/apxs ${phpcache_arg} --disable-fileinfo \
@@ -155,12 +159,17 @@ opcache.consistency_checks=0
 ;opcache.optimization_level=0
 EOF
 
-  if [ ! -e "${apache_install_dir}/bin/apxs" -o "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '4' ]; then
+  if [ ! -e "${apache_install_dir}/bin/apxs" -o "${Apache_flag}" == '24' ]; then
     # php-fpm Init Script
-    /bin/cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
-    chmod +x /etc/init.d/php-fpm
-    [ "${PM}" == 'yum' ] && { chkconfig --add php-fpm; chkconfig php-fpm on; }
-    [ "${PM}" == 'apt-get' ] && update-rc.d php-fpm defaults
+    if [ -e /bin/systemctl ]; then
+      /bin/cp sapi/fpm/php-fpm.service /lib/systemd/system/
+      systemctl enable php-fpm
+    else
+      /bin/cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
+      chmod +x /etc/init.d/php-fpm
+      [ "${PM}" == 'yum' ] && { chkconfig --add php-fpm; chkconfig php-fpm on; }
+      [ "${PM}" == 'apt-get' ] && update-rc.d php-fpm defaults
+    fi
 
     cat > ${php_install_dir}/etc/php-fpm.conf <<EOF
 ;;;;;;;;;;;;;;;;;;;;;
@@ -248,7 +257,7 @@ EOF
     #[ "$web_yn" == 'n' ] && sed -i "s@^listen =.*@listen = $IPADDR:9000@" ${php_install_dir}/etc/php-fpm.conf
     service php-fpm start
 
-  elif [ "${apache_option}" == '2' ] || [ "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '2' ]; then
+  elif [ "${apache_option}" == '2' ] || [ "${Apache_flag}" == '22' ]; then
     service httpd restart
   fi
   popd > /dev/null

+ 16 - 7
include/php-7.3.sh

@@ -10,6 +10,10 @@
 
 Install_PHP73() {
   pushd ${oneinstack_dir}/src > /dev/null
+  if [ -e "${apache_install_dir}/bin/apachectl" ];then
+    [ "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '4' ] && Apache_flag=24
+    [ "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '2' ] && Apache_flag=22
+  fi
   if [ ! -e "/usr/local/lib/libiconv.la" ]; then
     tar xzf libiconv-${libiconv_ver}.tar.gz
     patch -d libiconv-${libiconv_ver} -p0 < libiconv-glibc-2.16.patch
@@ -88,7 +92,7 @@ Install_PHP73() {
   ./buildconf
   [ ! -d "${php_install_dir}" ] && mkdir -p ${php_install_dir}
   [ "${phpcache_option}" == '1' ] && phpcache_arg='--enable-opcache' || phpcache_arg='--disable-opcache'
-  if [ "${apache_option}" == '2' ] || [ "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '2' ]; then
+  if [ "${apache_option}" == '2' ] || [ "${Apache_flag}" == '22' ]; then
     ./configure --prefix=${php_install_dir} --with-config-file-path=${php_install_dir}/etc \
     --with-config-file-scan-dir=${php_install_dir}/etc/php.d \
     --with-apxs2=${apache_install_dir}/bin/apxs ${phpcache_arg} --disable-fileinfo \
@@ -165,12 +169,17 @@ opcache.consistency_checks=0
 ;opcache.optimization_level=0
 EOF
 
-  if [ ! -e "${apache_install_dir}/bin/apxs" -o "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '4' ]; then
+  if [ ! -e "${apache_install_dir}/bin/apxs" -o "${Apache_flag}" == '24' ]; then
     # php-fpm Init Script
-    /bin/cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
-    chmod +x /etc/init.d/php-fpm
-    [ "${PM}" == 'yum' ] && { chkconfig --add php-fpm; chkconfig php-fpm on; }
-    [ "${PM}" == 'apt-get' ] && update-rc.d php-fpm defaults
+    if [ -e /bin/systemctl ]; then
+      /bin/cp sapi/fpm/php-fpm.service /lib/systemd/system/
+      systemctl enable php-fpm
+    else
+      /bin/cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
+      chmod +x /etc/init.d/php-fpm
+      [ "${PM}" == 'yum' ] && { chkconfig --add php-fpm; chkconfig php-fpm on; }
+      [ "${PM}" == 'apt-get' ] && update-rc.d php-fpm defaults
+    fi
 
     cat > ${php_install_dir}/etc/php-fpm.conf <<EOF
 ;;;;;;;;;;;;;;;;;;;;;
@@ -258,7 +267,7 @@ EOF
     #[ "$web_yn" == 'n' ] && sed -i "s@^listen =.*@listen = $IPADDR:9000@" ${php_install_dir}/etc/php-fpm.conf
     service php-fpm start
 
-  elif [ "${apache_option}" == '2' ] || [ "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '2' ]; then
+  elif [ "${apache_option}" == '2' ] || [ "${Apache_flag}" == '22' ]; then
     service httpd restart
   fi
   popd > /dev/null

+ 1 - 1
include/pureftpd.sh

@@ -37,7 +37,7 @@ Install_PureFTPd() {
     /bin/cp ../config/pure-ftpd.conf ${pureftpd_install_dir}/etc
     sed -i "s@^PureDB.*@PureDB  ${pureftpd_install_dir}/etc/pureftpd.pdb@" ${pureftpd_install_dir}/etc/pure-ftpd.conf
     sed -i "s@^LimitRecursion.*@LimitRecursion  65535 8@" ${pureftpd_install_dir}/etc/pure-ftpd.conf
-    [ -z "${IPADDR}" ] && IPADDR=127.0.0.1
+    IPADDR=${IPADDR:-127.0.0.1}
     [ ! -d /etc/ssl/private ] && mkdir -p /etc/ssl/private
     openssl dhparam -out /etc/ssl/private/pure-ftpd-dhparams.pem 2048
     openssl req -x509 -days 7300 -sha256 -nodes -subj "/C=CN/ST=Shanghai/L=Shanghai/O=OneinStack/CN=${IPADDR}" -newkey rsa:2048 -keyout /etc/ssl/private/pure-ftpd.pem -out /etc/ssl/private/pure-ftpd.pem

+ 2 - 2
include/upgrade_db.sh

@@ -34,7 +34,7 @@ Upgrade_DB() {
       break
     else
       echo
-      read -p "Please input the root password of database: " NEW_dbrootpwd
+      read -e -p "Please input the root password of database: " NEW_dbrootpwd
       ${db_install_dir}/bin/mysql -uroot -p${NEW_dbrootpwd} -e "quit" >/dev/null 2>&1
       if [ $? -eq 0 ]; then
         dbrootpwd=${NEW_dbrootpwd}
@@ -55,7 +55,7 @@ Upgrade_DB() {
   echo
   echo "Current ${DB} Version: ${CMSG}${OLD_db_ver}${CEND}"
   while :; do echo
-    read -p "Please input upgrade ${DB} Version(example: ${OLD_db_ver}): " NEW_db_ver
+    read -e -p "Please input upgrade ${DB} Version(example: ${OLD_db_ver}): " NEW_db_ver
     if [ `echo ${NEW_db_ver} | awk -F. '{print $1"."$2}'` == `echo ${OLD_db_ver} | awk -F. '{print $1"."$2}'` ]; then
       if [ "${DB}" == 'MariaDB' ]; then
         DB_name=mariadb-${NEW_db_ver}-${GLIBC_FLAG}-${SYS_BIT_b}

+ 3 - 3
include/upgrade_memcached.sh

@@ -13,11 +13,11 @@ Upgrade_Memcached() {
   [ ! -e "${memcached_install_dir}/bin/memcached" ] && echo "${CWARNING}Memcached is not installed on your system! ${CEND}" && exit 1
   OLD_memcached_ver=`${memcached_install_dir}/bin/memcached -V | awk '{print $2}'`
   Latest_memcached_ver=`curl --connect-timeout 2 -m 3 -s https://github.com/memcached/memcached/wiki/ReleaseNotes | grep 'internal present.*ReleaseNotes' |  grep -oE "[0-9]\.[0-9]\.[0-9]+" | head -1`
-  [ -z "${Latest_memcached_ver}" ] && Latest_memcached_ver=1.6.8
+  Latest_memcached_ver=${Latest_memcached_ver:-1.5.12}
   echo "Current Memcached Version: ${CMSG}${OLD_memcached_ver}${CEND}"
   while :; do echo
-    read -p "Please input upgrade Memcached Version(default: ${Latest_memcached_ver}): " NEW_memcached_ver
-    [ -z "${NEW_memcached_ver}" ] && NEW_memcached_ver=${Latest_memcached_ver}
+    read -e -p "Please input upgrade Memcached Version(default: ${Latest_memcached_ver}): " NEW_memcached_ver
+    NEW_memcached_ver=${NEW_memcached_ver:-${Latest_memcached_ver}}
     if [ "${NEW_memcached_ver}" != "${OLD_memcached_ver}" ]; then
       [ "$IPADDR_COUNTRY"x == "CN"x ] && DOWN_ADDR=http://mirrors.linuxeye.com/oneinstack/src || DOWN_ADDR=http://www.memcached.org/files
       [ ! -e "memcached-${NEW_memcached_ver}.tar.gz" ] && wget --no-check-certificate -c ${DOWN_ADDR}/memcached-${NEW_memcached_ver}.tar.gz > /dev/null 2>&1

+ 4 - 0
include/upgrade_oneinstack.sh

@@ -35,6 +35,10 @@ Upgrade_OneinStack() {
     rm -rf /tmp/{oneinstack.tar.gz,options.conf}
     [ "${ois_flag}" == 'n' ] && rm -f ss.sh LICENSE README.md
     sed -i "s@^oneinstack_md5=.*@oneinstack_md5=${Latest_OneinStack_MD5}@" ./options.conf
+    if [ -e "${php_install_dir}/sbin/php-fpm" ]; then
+      [ -n "`grep ^cgi.fix_pathinfo=0 ${php_install_dir}/etc/php.ini`" ] && sed -i 's@^cgi.fix_pathinfo.*@;&@' ${php_install_dir}/etc/php.ini
+      sed -i 's@^cgi.fix_pathinfo=0@;&@' /usr/local/php{53,54,55,56,70,71,72}/etc/php.ini
+    fi
     echo
     echo "${CSUCCESS}Congratulations! OneinStack upgrade successful! ${CEND}"
     echo

+ 3 - 3
include/upgrade_php.sh

@@ -13,12 +13,12 @@ Upgrade_PHP() {
   [ ! -e "${php_install_dir}" ] && echo "${CWARNING}PHP is not installed on your system! ${CEND}" && exit 1
   OLD_php_ver=`${php_install_dir}/bin/php -r 'echo PHP_VERSION;'`
   Latest_php_ver=`curl --connect-timeout 2 -m 3 -s http://php.net/downloads.php | awk '/Changelog/{print $2}' | grep "${OLD_php_ver%.*}"`
-  [ -z "$Latest_php_ver" ] && Latest_php_ver=5.5.38
+  Latest_php_ver=${Latest_php_ver:-5.5.38}
   echo
   echo "Current PHP Version: ${CMSG}$OLD_php_ver${CEND}"
   while :; do echo
-    read -p "Please input upgrade PHP Version(Default: $Latest_php_ver): " NEW_php_ver
-    [ -z "$NEW_php_ver" ] && NEW_php_ver=$Latest_php_ver
+    read -e -p "Please input upgrade PHP Version(Default: $Latest_php_ver): " NEW_php_ver
+    NEW_php_ver=${NEW_php_ver:-${Latest_php_ver}}
     if [ "${NEW_php_ver%.*}" == "${OLD_php_ver%.*}" ]; then
       [ ! -e "php-${NEW_php_ver}.tar.gz" ] && wget --no-check-certificate -c http://www.php.net/distributions/php-${NEW_php_ver}.tar.gz > /dev/null 2>&1
       if [ -e "php-${NEW_php_ver}.tar.gz" ]; then

+ 3 - 3
include/upgrade_phpmyadmin.sh

@@ -13,11 +13,11 @@ Upgrade_phpMyAdmin() {
   [ ! -e "${wwwroot_dir}/default/phpMyAdmin" ] && echo "${CWARNING}phpMyAdmin is not installed on your system! ${CEND}" && exit 1
   OLD_phpmyadmin_ver=`grep Version ${wwwroot_dir}/default/phpMyAdmin/README | awk '{print $2}'`
   Latest_phpmyadmin_ver=`curl --connect-timeout 2 -m 3 -s https://www.phpmyadmin.net/files/ | awk -F'>|<' '/\/files\/[0-9]/{print $5}' | head -1`
-  [ -z "$Latest_phpmyadmin_ver" ] && Latest_phpmyadmin_ver=4.8.6
+  Latest_phpmyadmin_ver=${Latest_phpmyadmin_ver:-4.8.3}
   echo "Current phpMyAdmin Version: ${CMSG}${OLD_phpmyadmin_ver}${CEND}"
   while :; do echo
-    read -p "Please input upgrade phpMyAdmin Version(default: $Latest_phpmyadmin_ver): " NEW_phpmyadmin_ver
-    [ -z "$NEW_phpmyadmin_ver" ] && NEW_phpmyadmin_ver=$Latest_phpmyadmin_ver
+    read -e -p "Please input upgrade phpMyAdmin Version(default: ${Latest_phpmyadmin_ver}): " NEW_phpmyadmin_ver
+    NEW_phpmyadmin_ver=${NEW_phpmyadmin_ver:-${Latest_phpmyadmin_ver}}
     if [ "${NEW_phpmyadmin_ver}" != "${OLD_phpmyadmin_ver}" ]; then
       [ ! -e "phpMyAdmin-${NEW_phpmyadmin_ver}-all-languages.tar.gz" ] && wget --no-check-certificate -c https://files.phpmyadmin.net/phpMyAdmin/${NEW_phpmyadmin_ver}/phpMyAdmin-${NEW_phpmyadmin_ver}-all-languages.tar.gz > /dev/null 2>&1
       if [ -e "phpMyAdmin-${NEW_phpmyadmin_ver}-all-languages.tar.gz" ]; then

+ 3 - 3
include/upgrade_redis.sh

@@ -13,11 +13,11 @@ Upgrade_Redis() {
   [ ! -d "$redis_install_dir" ] && echo "${CWARNING}Redis is not installed on your system! ${CEND}" && exit 1
   OLD_redis_ver=`$redis_install_dir/bin/redis-cli --version | awk '{print $2}'`
   Latest_redis_ver=`curl --connect-timeout 2 -m 3 -s http://download.redis.io/redis-stable/00-RELEASENOTES | awk '/Released/{print $2}' | head -1`
-  [ -z "$Latest_redis_ver" ] && Latest_redis_ver=4.2.8
+  Latest_redis_ver=${Latest_redis_ver:-5.0.2}
   echo "Current Redis Version: ${CMSG}$OLD_redis_ver${CEND}"
   while :; do echo
-    read -p "Please input upgrade Redis Version(default: $Latest_redis_ver): " NEW_redis_ver
-    [ -z "$NEW_redis_ver" ] && NEW_redis_ver=$Latest_redis_ver
+    read -e -p "Please input upgrade Redis Version(default: ${Latest_redis_ver}): " NEW_redis_ver
+    NEW_redis_ver=${NEW_redis_ver:-${Latest_redis_ver}}
     if [ "$NEW_redis_ver" != "$OLD_redis_ver" ]; then
       [ ! -e "redis-$NEW_redis_ver.tar.gz" ] && wget --no-check-certificate -c http://download.redis.io/releases/redis-$NEW_redis_ver.tar.gz > /dev/null 2>&1
       if [ -e "redis-$NEW_redis_ver.tar.gz" ]; then

+ 14 - 14
include/upgrade_web.sh

@@ -18,8 +18,8 @@ Upgrade_Nginx() {
   echo
   echo "Current Nginx Version: ${CMSG}${OLD_nginx_ver}${CEND}"
   while :; do echo
-    read -p "Please input upgrade Nginx Version(default: ${Latest_nginx_ver}): " NEW_nginx_ver
-    [ -z "${NEW_nginx_ver}" ] && NEW_nginx_ver=${Latest_nginx_ver}
+    read -e -p "Please input upgrade Nginx Version(default: ${Latest_nginx_ver}): " NEW_nginx_ver
+    NEW_nginx_ver=${NEW_nginx_ver:-${Latest_nginx_ver}}
     if [ "${NEW_nginx_ver}" != "${OLD_nginx_ver}" ]; then
       [ ! -e "nginx-${NEW_nginx_ver}.tar.gz" ] && wget --no-check-certificate -c http://nginx.org/download/nginx-${NEW_nginx_ver}.tar.gz > /dev/null 2>&1
       if [ -e "nginx-${NEW_nginx_ver}.tar.gz" ]; then
@@ -80,8 +80,8 @@ Upgrade_Tengine() {
   echo
   echo "Current Tengine Version: ${CMSG}${OLD_tengine_ver}${CEND}"
   while :; do echo
-    read -p "Please input upgrade Tengine Version(default: ${Latest_tengine_ver}): " NEW_tengine_ver
-    [ -z "${NEW_tengine_ver}" ] && NEW_tengine_ver=${Latest_tengine_ver}
+    read -e -p "Please input upgrade Tengine Version(default: ${Latest_tengine_ver}): " NEW_tengine_ver
+    NEW_tengine_ver=${NEW_tengine_ver:-${Latest_tengine_ver}}
     if [ "${NEW_tengine_ver}" != "${OLD_tengine_ver}" ]; then
       [ ! -e "tengine-${NEW_tengine_ver}.tar.gz" ] && wget --no-check-certificate -c http://tengine.taobao.org/download/tengine-${NEW_tengine_ver}.tar.gz > /dev/null 2>&1
       if [ -e "tengine-${NEW_tengine_ver}.tar.gz" ]; then
@@ -147,8 +147,8 @@ Upgrade_OpenResty() {
   echo
   echo "Current OpenResty Version: ${CMSG}${OLD_openresy_ver}${CEND}"
   while :; do echo
-    read -p "Please input upgrade OpenResty Version(default: ${Latest_openresy_ver}): " NEW_openresy_ver
-    [ -z "${NEW_openresy_ver}" ] && NEW_openresy_ver=${Latest_openresy_ver}
+    read -e -p "Please input upgrade OpenResty Version(default: ${Latest_openresy_ver}): " NEW_openresy_ver
+    NEW_openresy_ver=${NEW_openresy_ver:-${Latest_openresy_ver}}
     if [ "${NEW_openresy_ver}" != "${OLD_openresy_ver}" ]; then
       [ ! -e "openresty-${NEW_openresy_ver}.tar.gz" ] && wget --no-check-certificate -c https://openresty.org/download/openresty-${NEW_openresy_ver}.tar.gz > /dev/null 2>&1
       if [ -e "openresty-${NEW_openresy_ver}.tar.gz" ]; then
@@ -202,12 +202,12 @@ Upgrade_Apache() {
   OLD_apache_ver="`${apache_install_dir}/bin/httpd -v | grep version | awk -F'/| ' '{print $4}'`"
   Apache_flag="`echo ${OLD_apache_ver} | awk -F. '{print $1 $2}'`"
   Latest_apache_ver=`curl --connect-timeout 2 -m 3 -s http://httpd.apache.org/download.cgi | awk "/#apache${Apache_flag}/{print $2}" | head -1 | grep -oE "2\.[24]\.[0-9]+"`
-  [ -z "${Latest_apache_ver}" ] && Latest_apache_ver=${apache22_ver}
+  Latest_apache_ver=${Latest_apache_ver:-${apache22_ver}}
   echo
   echo "Current Apache Version: ${CMSG}${OLD_apache_ver}${CEND}"
   while :; do echo
-    read -p "Please input upgrade Apache Version(Default: ${Latest_apache_ver}): " NEW_apache_ver
-    [ -z "${NEW_apache_ver}" ] && NEW_apache_ver=${Latest_apache_ver}
+    read -e -p "Please input upgrade Apache Version(Default: ${Latest_apache_ver}): " NEW_apache_ver
+    NEW_apache_ver=${NEW_apache_ver:-${Latest_apache_ver}}
     if [ `echo ${NEW_apache_ver} | awk -F. '{print $1$2}'` == "${Apache_flag}" ]; then
       if [ "${NEW_apache_ver}" != "${OLD_apache_ver}" ]; then
         if [ "${Apache_flag}" == '24' ]; then
@@ -269,12 +269,12 @@ Upgrade_Tomcat() {
   OLD_tomcat_ver="`${tomcat_install_dir}/bin/version.sh | awk '/Server number/{print $3}' | awk -F. '{print $1"."$2"."$3}'`"
   Tomcat_flag="`echo ${OLD_tomcat_ver} | awk -F. '{print $1}'`"
   Latest_tomcat_ver=`curl --connect-timeout 2 -m 3 -s https://tomcat.apache.org/download-${Tomcat_flag}0.cgi | grep "README" | head -1 | grep -oE "[6-9]\.[0-9]\.[0-9]+"`
-  [ -z "${Latest_tomcat_ver}" ] && Latest_tomcat_ver=${tomcat9_ver}
+  Latest_tomcat_ver=${Latest_tomcat_ver:-${tomcat9_ver}}
   echo
   echo "Current Tomcat Version: ${CMSG}${OLD_tomcat_ver}${CEND}"
   while :; do echo
-    read -p "Please input upgrade Tomcat Version(Default: ${Latest_tomcat_ver}): " NEW_tomcat_ver
-    [ -z "${NEW_tomcat_ver}" ] && NEW_tomcat_ver=${Latest_tomcat_ver}
+    read -e -p "Please input upgrade Tomcat Version(Default: ${Latest_tomcat_ver}): " NEW_tomcat_ver
+    NEW_tomcat_ver=${NEW_tomcat_ver:-${Latest_tomcat_ver}}
     if [ "`echo ${NEW_tomcat_ver} | awk -F. '{print $1}'`" == "${Tomcat_flag}" ]; then
       rm -f catalina-jmx-remote.jar
       echo "Download tomcat-${NEW_tomcat_ver}..."
@@ -304,11 +304,11 @@ Upgrade_Tomcat() {
     /bin/cp -R ${tomcat_install_dir}/conf/vhost apache-tomcat-${NEW_tomcat_ver}/conf/
     chmod +x apache-tomcat-${NEW_tomcat_ver}/bin/*.sh
     [[ -d ${tomcat_install_dir}_bak && -d ${tomcat_install_dir} ]] && rm -rf ${tomcat_install_dir}._bak
-    /etc/init.d/tomcat stop
+    service tomcat stop
     /bin/mv ${tomcat_install_dir}{,_bak}
     /bin/mv apache-tomcat-${NEW_tomcat_ver} ${tomcat_install_dir} && chown -R ${run_user}.${run_user} ${tomcat_install_dir}
     if [ -e "${tomcat_install_dir}/conf/server.xml" ]; then
-      /etc/init.d/tomcat start
+      service tomcat start
       echo "You have ${CMSG}successfully${CEND} upgrade from ${CWARNING}${OLD_tomcat_ver}${CEND} to ${CWARNING}${NEW_tomcat_ver}${CEND}"
     else
       echo "${CFAILURE}Upgrade Tomcat failed! ${CEND}"

+ 20 - 20
install.sh

@@ -192,7 +192,7 @@ if [ -e "/etc/ssh/sshd_config" ]; then
     [ -z "`grep ^Port /etc/ssh/sshd_config`" ] && now_ssh_port=22 || now_ssh_port=`grep ^Port /etc/ssh/sshd_config | awk '{print $2}'`
     while :; do echo
       read -e -p "Please input SSH port(Default: ${now_ssh_port}): " ssh_port
-      [ -z "${ssh_port}" ] && ssh_port=${now_ssh_port}
+      ssh_port=${ssh_port:-${now_ssh_port}}
       if [ ${ssh_port} -eq 22 >/dev/null 2>&1 -o ${ssh_port} -gt 1024 >/dev/null 2>&1 -a ${ssh_port} -lt 65535 >/dev/null 2>&1 ]; then
         break
       else
@@ -234,7 +234,7 @@ if [ ${ARG_NUM} == 0 ]; then
           echo -e "\t${CMSG}3${CEND}. Install OpenResty"
           echo -e "\t${CMSG}4${CEND}. Do not install"
           read -e -p "Please input a number:(Default 1 press Enter) " nginx_option
-          [ -z "${nginx_option}" ] && nginx_option=1
+          nginx_option=${nginx_option:-1}
           if [[ ! ${nginx_option} =~ ^[1-4]$ ]]; then
             echo "${CWARNING}input error! Please only input number 1~4${CEND}"
           else
@@ -251,7 +251,7 @@ if [ ${ARG_NUM} == 0 ]; then
           echo -e "\t${CMSG}2${CEND}. Install Apache-2.2"
           echo -e "\t${CMSG}3${CEND}. Do not install"
           read -e -p "Please input a number:(Default 3 press Enter) " apache_option
-          [ -z "${apache_option}" ] && apache_option=3
+          apache_option=${apache_option:-3}
           if [[ ! ${apache_option} =~ ^[1-3]$ ]]; then
             echo "${CWARNING}input error! Please only input number 1~3${CEND}"
           else
@@ -268,7 +268,7 @@ if [ ${ARG_NUM} == 0 ]; then
           echo -e "\t${CMSG}4${CEND}. Install Tomcat-6"
           echo -e "\t${CMSG}5${CEND}. Do not install"
           read -e -p "Please input a number:(Default 5 press Enter) " tomcat_option
-          [ -z "${tomcat_option}" ] && tomcat_option=5
+          tomcat_option=${tomcat_option:-5}
           if [[ ! ${tomcat_option} =~ ^[1-5]$ ]]; then
             echo "${CWARNING}input error! Please only input number 1~5${CEND}"
           else
@@ -279,7 +279,7 @@ if [ ${ARG_NUM} == 0 ]; then
                 echo -e "\t${CMSG}1${CEND}. Install JDK-11.0"
                 echo -e "\t${CMSG}2${CEND}. Install JDK-1.8"
                 read -e -p "Please input a number:(Default 1 press Enter) " jdk_option
-                [ -z "${jdk_option}" ] && jdk_option=1
+                jdk_option=${jdk_option:-1}
                 if [[ ! ${jdk_option} =~ ^[1-2]$ ]]; then
                   echo "${CWARNING}input error! Please only input number 1~2${CEND}"
                 else
@@ -293,7 +293,7 @@ if [ ${ARG_NUM} == 0 ]; then
                 echo -e "\t${CMSG}2${CEND}. Install JDK-1.8"
                 echo -e "\t${CMSG}3${CEND}. Install JDK-1.7"
                 read -e -p "Please input a number:(Default 2 press Enter) " jdk_option
-                [ -z "${jdk_option}" ] && jdk_option=2
+                jdk_option=${jdk_option:-2}
                 if [[ ! ${jdk_option} =~ ^[1-3]$ ]]; then
                   echo "${CWARNING}input error! Please only input number 1~3${CEND}"
                 else
@@ -307,7 +307,7 @@ if [ ${ARG_NUM} == 0 ]; then
                 echo -e "\t${CMSG}3${CEND}. Install JDK-1.7"
                 echo -e "\t${CMSG}4${CEND}. Install JDK-1.6"
                 read -e -p "Please input a number:(Default 3 press Enter) " jdk_option
-                [ -z "${jdk_option}" ] && jdk_option=3
+                jdk_option=${jdk_option:-3}
                 if [[ ! ${jdk_option} =~ ^[2-4]$ ]]; then
                   echo "${CWARNING}input error! Please only input number 2~4${CEND}"
                 else
@@ -320,7 +320,7 @@ if [ ${ARG_NUM} == 0 ]; then
                 echo -e "\t${CMSG}3${CEND}. Install JDK-1.7"
                 echo -e "\t${CMSG}4${CEND}. Install JDK-1.6"
                 read -e -p "Please input a number:(Default 4 press Enter) " jdk_option
-                [ -z "${jdk_option}" ] && jdk_option=4
+                jdk_option=${jdk_option:-4}
                 if [[ ! ${jdk_option} =~ ^[3-4]$ ]]; then
                   echo "${CWARNING}input error! Please only input number 3~4${CEND}"
                 else
@@ -361,7 +361,7 @@ if [ ${ARG_NUM} == 0 ]; then
           echo -e "\t${CMSG}14${CEND}. Install PostgreSQL"
           echo -e "\t${CMSG}15${CEND}. Install MongoDB"
           read -e -p "Please input a number:(Default 2 press Enter) " db_option
-          [ -z "${db_option}" ] && db_option=2
+          db_option=${db_option:-2}
           [[ "${db_option}" =~ ^5$|^15$ ]] && [ "${OS_BIT}" == '32' ] && { echo "${CWARNING}By not supporting 32-bit! ${CEND}"; continue; }
           if [[ "${db_option}" =~ ^[1-9]$|^1[0-5]$ ]]; then
             if [ "${db_option}" == '14' ]; then
@@ -374,13 +374,13 @@ if [ ${ARG_NUM} == 0 ]; then
             while :; do
               if [ "${db_option}" == '14' ]; then
                 read -e -p "Please input the postgres password of PostgreSQL(default: ${dbpostgrespwd}): " dbpwd
-                [ -z "${dbpwd}" ] && dbpwd=${dbpostgrespwd}
+                dbpwd=${dbpwd:-${dbpostgrespwd}}
               elif [ "${db_option}" == '15' ]; then
                 read -e -p "Please input the root password of MongoDB(default: ${dbmongopwd}): " dbpwd
-                [ -z "${dbpwd}" ] && dbpwd=${dbmongopwd}
+                dbpwd=${dbpwd:-${dbmongopwd}}
               else
                 read -e -p "Please input the root password of MySQL(default: ${dbrootpwd}): " dbpwd
-                [ -z "${dbpwd}" ] && dbpwd=${dbrootpwd}
+                dbpwd=${dbpwd:-${dbrootpwd}}
               fi
               [ -n "`echo ${dbpwd} | grep '[+|&]'`" ] && { echo "${CWARNING}input error,not contain a plus sign (+) and & ${CEND}"; continue; }
               if (( ${#dbpwd} >= 5 )); then
@@ -403,7 +403,7 @@ if [ ${ARG_NUM} == 0 ]; then
                 echo -e "\t${CMSG}1${CEND}. Install database from binary package."
                 echo -e "\t${CMSG}2${CEND}. Install database from source package."
                 read -e -p "Please input a number:(Default 1 press Enter) " dbinstallmethod
-                [ -z "${dbinstallmethod}" ] && dbinstallmethod=1
+                dbinstallmethod=${dbinstallmethod:-1}
                 if [[ ! ${dbinstallmethod} =~ ^[1-2]$ ]]; then
                   echo "${CWARNING}input error! Please only input number 1~2${CEND}"
                 else
@@ -441,7 +441,7 @@ if [ ${ARG_NUM} == 0 ]; then
           echo -e "\t${CMSG}7${CEND}. Install php-7.2"
           echo -e "\t${CMSG}8${CEND}. Install php-7.3"
           read -e -p "Please input a number:(Default 5 press Enter) " php_option
-          [ -z "${php_option}" ] && php_option=5
+          php_option=${php_option:-5}
           if [[ ! ${php_option} =~ ^[1-8]$ ]]; then
             echo "${CWARNING}input error! Please only input number 1~8${CEND}"
           else
@@ -459,7 +459,7 @@ if [ ${ARG_NUM} == 0 ]; then
                       echo -e "\t${CMSG}3${CEND}. Install APCU"
                       echo -e "\t${CMSG}4${CEND}. Install eAccelerator-0.9"
                       read -e -p "Please input a number:(Default 1 press Enter) " phpcache_option
-                      [ -z "${phpcache_option}" ] && phpcache_option=1
+                      phpcache_option=${phpcache_option:-1}
                       if [[ ! ${phpcache_option} =~ ^[1-4]$ ]]; then
                         echo "${CWARNING}input error! Please only input number 1~4${CEND}"
                       else
@@ -475,7 +475,7 @@ if [ ${ARG_NUM} == 0 ]; then
                       echo -e "\t${CMSG}3${CEND}. Install APCU"
                       echo -e "\t${CMSG}4${CEND}. Install eAccelerator-1.0-dev"
                       read -e -p "Please input a number:(Default 1 press Enter) " phpcache_option
-                      [ -z "${phpcache_option}" ] && phpcache_option=1
+                      phpcache_option=${phpcache_option:-1}
                       if [[ ! ${phpcache_option} =~ ^[1-4]$ ]]; then
                         echo "${CWARNING}input error! Please only input number 1~4${CEND}"
                       else
@@ -490,7 +490,7 @@ if [ ${ARG_NUM} == 0 ]; then
                       echo -e "\t${CMSG}2${CEND}. Install XCache"
                       echo -e "\t${CMSG}3${CEND}. Install APCU"
                       read -e -p "Please input a number:(Default 1 press Enter) " phpcache_option
-                      [ -z "${phpcache_option}" ] && phpcache_option=1
+                      phpcache_option=${phpcache_option:-1}
                       if [[ ! ${phpcache_option} =~ ^[1-3]$ ]]; then
                         echo "${CWARNING}input error! Please only input number 1~3${CEND}"
                       else
@@ -505,7 +505,7 @@ if [ ${ARG_NUM} == 0 ]; then
                       echo -e "\t${CMSG}2${CEND}. Install XCache"
                       echo -e "\t${CMSG}3${CEND}. Install APCU"
                       read -e -p "Please input a number:(Default 1 press Enter) " phpcache_option
-                      [ -z "${phpcache_option}" ] && phpcache_option=1
+                      phpcache_option=${phpcache_option:-1}
                       if [[ ! ${phpcache_option} =~ ^[1-3]$ ]]; then
                         echo "${CWARNING}input error! Please only input number 1~3${CEND}"
                       else
@@ -519,7 +519,7 @@ if [ ${ARG_NUM} == 0 ]; then
                       echo -e "\t${CMSG}1${CEND}. Install Zend OPcache"
                       echo -e "\t${CMSG}3${CEND}. Install APCU"
                       read -e -p "Please input a number:(Default 1 press Enter) " phpcache_option
-                      [ -z "${phpcache_option}" ] && phpcache_option=1
+                      phpcache_option=${phpcache_option:-1}
                       if [[ ! ${phpcache_option} =~ ^[1,3]$ ]]; then
                         echo "${CWARNING}input error! Please only input number 1,3${CEND}"
                       else
@@ -577,7 +577,7 @@ if [ ${ARG_NUM} == 0 ]; then
                 echo -e "\t${CMSG}1${CEND}. Install ImageMagick"
                 echo -e "\t${CMSG}2${CEND}. Install GraphicsMagick"
                 read -e -p "Please input a number:(Default 1 press Enter) " magick_option
-                [ -z "${magick_option}" ] && magick_option=1
+                magick_option=${magick_option:-1}
                 if [[ ! ${magick_option} =~ ^[1-2]$ ]]; then
                   echo "${CWARNING}input error! Please only input number 1~2${CEND}"
                 else

+ 1 - 3
pureftpd_vhost.sh

@@ -61,9 +61,7 @@ done
 DIRECTORY() {
 while :; do echo
   read -e -p "Please input the directory(Default directory: ${wwwroot_dir}): " Directory
-  if [ -z "${Directory}" ]; then
-    Directory="${wwwroot_dir}"
-  fi
+  Directory=${Directory:-${wwwroot_dir}}
   if [ ! -d "${Directory}" ]; then
     echo "${CWARNING}The directory does not exist${CEND}"
   else

+ 3 - 3
reset_db_root_password.sh

@@ -89,7 +89,7 @@ Reset_Interaction_dbrootpwd() {
 Reset_force_dbrootpwd() {
   DB_Ver="`${db_install_dir}/bin/mysql_config --version`"
   echo "${CMSG}Stopping MySQL...${CEND}"
-  /etc/init.d/mysqld stop > /dev/null 2>&1
+  service mysqld stop > /dev/null 2>&1
   while [ -n "`ps -ef | grep mysql | grep -v grep | awk '{print $2}'`" ]; do
     sleep 1
   done
@@ -115,7 +115,7 @@ EOF
       sleep 1
     done
     [ -n "`ps -ef | grep mysql | grep -v grep | awk '{print $2}'`" ] && ps -ef | grep mysql | grep -v grep | awk '{print $2}' | xargs kill -9 > /dev/null 2>&1
-    /etc/init.d/mysqld start > /dev/null 2>&1
+    service mysqld start > /dev/null 2>&1
     sed -i "s+^dbrootpwd.*+dbrootpwd='${New_dbrootpwd}'+" ./options.conf
     [ -e ~/ReadMe ] && sed -i "s+^MySQL root password:.*+MySQL root password: ${New_dbrootpwd}+"  ~/ReadMe
     echo
@@ -130,7 +130,7 @@ if [ "${quiet_yn}" == 'y' ]; then
   if [ "${force_yn}" == 'y' ]; then
     Reset_force_dbrootpwd
   else
-    sleep 2 && [ ! -e /tmp/mysql.sock ] && /etc/init.d/mysqld start
+    sleep 2 && [ ! -e /tmp/mysql.sock ] && service mysqld start
     Reset_Interaction_dbrootpwd
   fi
 else

+ 8 - 8
ss.sh

@@ -62,7 +62,7 @@ Iptables_set() {
 
   while :; do echo
     read -e -p "Please input SS port(Default: ${SS_Default_port}): " SS_port
-    [ -z "${SS_port}" ] && SS_port=${SS_Default_port}
+    SS_port=${SS_port:-${SS_Default_port}}
     if [ ${SS_port} -ge 1 >/dev/null 2>&1 -a ${SS_port} -le 65535 >/dev/null 2>&1 ]; then
       [ -z "$(netstat -tpln | grep :${SS_port}$)" ] && break || echo "${CWARNING}This port is already used! ${CEND}"
     else
@@ -92,7 +92,7 @@ Def_parameter() {
     echo -e "\t${CMSG}1${CEND}. Install SS-libev"
     echo -e "\t${CMSG}2${CEND}. Install SS-python"
     read -e -p "Please input a number:(Default 1 press Enter) " ss_option
-    [ -z "${ss_option}" ] && ss_option=1
+    ss_option=${ss_option:-1}
     if [[ ! "${ss_option}" =~ ^[1-2]$ ]]; then
       echo "${CWARNING}input error! Please only input number 1~2${CEND}"
     else
@@ -135,9 +135,9 @@ Install_SS-python() {
 }
 
 Install_SS-libev() {
-  src_url=http://mirrors.linuxeye.com/oneinstack/src/shadowsocks-libev-3.2.0.tar.gz && Download_src
+  src_url=http://mirrors.linuxeye.com/oneinstack/src/shadowsocks-libev-3.2.3.tar.gz && Download_src
   src_url=http://mirrors.linuxeye.com/oneinstack/src/libsodium-${libsodium_ver}.tar.gz && Download_src
-  src_url=http://mirrors.linuxeye.com/oneinstack/src/mbedtls-2.11.0-apache.tgz && Download_src
+  src_url=http://mirrors.linuxeye.com/oneinstack/src/mbedtls-2.14.1-apache.tgz && Download_src
   if [ ! -e "/usr/local/lib/libsodium.la" ]; then
     tar xzf libsodium-${libsodium_ver}.tar.gz
     pushd libsodium-${libsodium_ver}
@@ -146,13 +146,13 @@ Install_SS-libev() {
     popd
     rm -rf libsodium-${libsodium_ver}
   fi
-  tar xzf mbedtls-2.11.0-apache.tgz
-  pushd mbedtls-2.11.0
+  tar xzf mbedtls-2.14.1-apache.tgz
+  pushd mbedtls-2.14.1
   make SHARED=1 CFLAGS=-fPIC
   make DESTDIR=/usr install
   popd
-  tar xzf shadowsocks-libev-3.2.0.tar.gz
-  pushd shadowsocks-libev-3.2.0
+  tar xzf shadowsocks-libev-3.2.3.tar.gz
+  pushd shadowsocks-libev-3.2.3
   make clean
   ./configure
   make -j ${THREAD} && make install

+ 4 - 2
uninstall.sh

@@ -162,14 +162,16 @@ Uninstall_MongoDB() {
 Print_PHP() {
   [ -e "${php_install_dir}" ] && echo "${php_install_dir}"
   [ -e "/etc/init.d/php-fpm" ] && echo "/etc/init.d/php-fpm"
+  [ -e "/lib/systemd/system/php-fpm.service" ] && echo '/lib/systemd/system/php-fpm.service'
   [ -e "${imagick_install_dir}" ] && echo "${imagick_install_dir}"
   [ -e "${gmagick_install_dir}" ] && echo "${gmagick_install_dir}"
   [ -e "${curl_install_dir}" ] && echo "${curl_install_dir}"
 }
 
 Uninstall_PHP() {
-  [ -e "${php_install_dir}/bin/phpize" -a -e "${php_install_dir}/etc/php-fpm.conf" ] && { service php-fpm stop > /dev/null 2>&1; rm -rf ${php_install_dir} /etc/init.d/php-fpm; echo "${CMSG}PHP uninstall completed! ${CEND}"; }
-  [ -e "${php_install_dir}/bin/phpize" -a ! -e "${php_install_dir}/etc/php-fpm.conf" ] && { rm -rf ${php_install_dir}; echo "${CMSG}PHP uninstall completed! ${CEND}"; }
+  [ -e "/etc/init.d/php-fpm" ] && { service php-fpm stop > /dev/null 2>&1; rm -f /etc/init.d/php-fpm; }
+  [ -e "/lib/systemd/system/php-fpm.service" ] && { systemctl stop php-fpm > /dev/null 2>&1; systemctl disable php-fpm > /dev/null 2>&1; rm -f /lib/systemd/system/php-fpm.service; }
+  [ -e "${php_install_dir}" ] && { rm -rf ${php_install_dir}; echo "${CMSG}PHP uninstall completed! ${CEND}"; }
   [ -e "${imagick_install_dir}" ] && rm -rf ${imagick_install_dir}
   [ -e "${gmagick_install_dir}" ] && rm -rf ${gmagick_install_dir}
   [ -e "${curl_install_dir}" ] && rm -rf "${curl_install_dir}"

+ 3 - 3
versions.txt

@@ -51,7 +51,7 @@ php73_ver=7.3.0
 php72_ver=7.2.13
 php71_ver=7.1.25
 php70_ver=7.0.33
-php56_ver=5.6.38
+php56_ver=5.6.39
 php55_ver=5.5.38
 php54_ver=5.4.45
 php53_ver=5.3.29
@@ -64,7 +64,7 @@ mhash_ver=0.9.9.9
 libsodium_ver=1.0.16
 argon2_ver=20171227
 libzip_ver=1.3.2
-imagemagick_ver=6.9.10-15
+imagemagick_ver=6.9.10-16
 imagick_ver=3.4.3
 graphicsmagick_ver=1.3.30
 gmagick_for_php7_ver=2.0.5RC1
@@ -89,7 +89,7 @@ pecl_redis_ver=4.2.0
 memcached_ver=1.5.12
 libmemcached_ver=1.0.18
 pecl_memcached_ver=2.2.0
-pecl_memcached_php7_ver=3.0.4
+pecl_memcached_php7_ver=3.1.0
 pecl_memcache_ver=3.0.8
 
 # MongoDB

+ 20 - 20
vhost.sh

@@ -40,6 +40,10 @@ ${CMSG}dnsapi${CEND}   --->Use dns API to automatically issue Let's Encrypt Cert
 }
 
 Choose_env() {
+  if [ -e "${apache_install_dir}/bin/apachectl" ];then
+    [ "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '4' ] && { Apache_flag=24; Apache_grant='Require all granted'; }
+    [ "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '2' ] && Apache_flag=22
+  fi
   if [ -e "${php_install_dir}/bin/phpize" -a -e "${tomcat_install_dir}/conf/server.xml" -a -e "/usr/bin/hhvm" ]; then
     Number=111
     while :; do echo
@@ -48,7 +52,7 @@ Choose_env() {
       echo -e "\t${CMSG}2${CEND}. Use java"
       echo -e "\t${CMSG}3${CEND}. Use hhvm"
       read -e -p "Please input a number:(Default 1 press Enter) " ENV_FLAG
-      [ -z "${ENV_FLAG}" ] && ENV_FLAG=1
+      ENV_FLAG=${ENV_FLAG:-1}
       if [[ ! ${ENV_FLAG} =~ ^[1-3]$ ]]; then
         echo "${CWARNING}input error! Please only input number 1~3${CEND}"
       else
@@ -73,7 +77,7 @@ Choose_env() {
       echo -e "\t${CMSG}1${CEND}. Use php"
       echo -e "\t${CMSG}2${CEND}. Use java"
       read -e -p "Please input a number:(Default 1 press Enter) " ENV_FLAG
-      [ -z "${ENV_FLAG}" ] && ENV_FLAG=1
+      ENV_FLAG=${ENV_FLAG:-1}
       if [[ ! ${ENV_FLAG} =~ ^[1-2]$ ]]; then
         echo "${CWARNING}input error! Please only input number 1~2${CEND}"
       else
@@ -92,7 +96,7 @@ Choose_env() {
       echo -e "\t${CMSG}1${CEND}. Use php"
       echo -e "\t${CMSG}2${CEND}. Use hhvm"
       read -e -p "Please input a number:(Default 1 press Enter) " ENV_FLAG
-      [ -z "${ENV_FLAG}" ] && ENV_FLAG=1
+      ENV_FLAG=${ENV_FLAG:-1}
       if [[ ! ${ENV_FLAG} =~ ^[1-2]$ ]]; then
         echo "${CWARNING}input error! Please only input number 1~2${CEND}"
       else
@@ -108,7 +112,7 @@ Choose_env() {
       echo -e "\t${CMSG}1${CEND}. Use java"
       echo -e "\t${CMSG}2${CEND}. Use hhvm"
       read -e -p "Please input a number:(Default 1 press Enter) " ENV_FLAG
-      [ -z "${ENV_FLAG}" ] && ENV_FLAG=1
+      ENV_FLAG=${ENV_FLAG:-1}
       if [[ ! ${ENV_FLAG} =~ ^[1-2]$ ]]; then
         echo "${CWARNING}input error! Please only input number 1~2${CEND}"
       else
@@ -153,19 +157,19 @@ If you enter '.', the field will be left blank.
 "
     echo
     read -e -p "Country Name (2 letter code) [CN]: " SELFSIGNEDSSL_C
-    [ -z "${SELFSIGNEDSSL_C}" ] && SELFSIGNEDSSL_C="CN"
+    SELFSIGNEDSSL_C=${SELFSIGNEDSSL_C:-CN}
     echo
     read -e -p "State or Province Name (full name) [Shanghai]: " SELFSIGNEDSSL_ST
-    [ -z "${SELFSIGNEDSSL_ST}" ] && SELFSIGNEDSSL_ST="Shanghai"
+    SELFSIGNEDSSL_ST=${SELFSIGNEDSSL_ST:-Shanghai}
     echo
     read -e -p "Locality Name (eg, city) [Shanghai]: " SELFSIGNEDSSL_L
-    [ -z "${SELFSIGNEDSSL_L}" ] && SELFSIGNEDSSL_L="Shanghai"
+    SELFSIGNEDSSL_L=${SELFSIGNEDSSL_L:-Shanghai}
     echo
     read -e -p "Organization Name (eg, company) [Example Inc.]: " SELFSIGNEDSSL_O
-    [ -z "${SELFSIGNEDSSL_O}" ] && SELFSIGNEDSSL_O="Example Inc."
+    SELFSIGNEDSSL_O=${SELFSIGNEDSSL_O:-"Example Inc."}
     echo
     read -e -p "Organizational Unit Name (eg, section) [IT Dept.]: " SELFSIGNEDSSL_OU
-    [ -z "${SELFSIGNEDSSL_OU}" ] && SELFSIGNEDSSL_OU="IT Dept."
+    SELFSIGNEDSSL_OU=${SELFSIGNEDSSL_OU:-"IT Dept."}
 
     openssl req -new -newkey rsa:2048 -sha256 -nodes -out ${PATH_SSL}/${domain}.csr -keyout ${PATH_SSL}/${domain}.key -subj "/C=${SELFSIGNEDSSL_C}/ST=${SELFSIGNEDSSL_ST}/L=${SELFSIGNEDSSL_L}/O=${SELFSIGNEDSSL_O}/OU=${SELFSIGNEDSSL_OU}/CN=${domain}" > /dev/null 2>&1
     openssl x509 -req -days 36500 -sha256 -in ${PATH_SSL}/${domain}.csr -signkey ${PATH_SSL}/${domain}.key -out ${PATH_SSL}/${domain}.crt > /dev/null 2>&1
@@ -202,7 +206,6 @@ If you enter '.', the field will be left blank.
         ${web_install_dir}/sbin/nginx -s reload
       fi
       if [ "${apache_ssl_flag}" == 'y' ]; then
-        [ "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '4' ] && Apache_grant='Require all granted'
         [ ! -d ${apache_install_dir}/conf/vhost ] && mkdir ${apache_install_dir}/conf/vhost
         cat > ${apache_install_dir}/conf/vhost/${domain}.conf << EOF
 <VirtualHost *:80>
@@ -460,8 +463,7 @@ Nginx_rewrite() {
     fi
     echo "You choose rewrite=${CMSG}$rewrite${CEND}"
     [ "${NGX_FLAG}" == 'php' -a "${rewrite}" == "joomla" ] && NGX_CONF=$(echo -e "location ~ \\.php\$ {\n    #fastcgi_pass remote_php_ip:9000;\n    fastcgi_pass unix:/dev/shm/php-cgi.sock;\n    fastcgi_index index.php;\n    include fastcgi.conf;\n  }")
-    [ "${NGX_FLAG}" == 'php' -a "${rewrite}" == "thinkphp" ] && NGX_CONF=$(echo -e "location ~ \.php {\n    #fastcgi_pass remote_php_ip:9000;\n    fastcgi_pass unix:/dev/shm/php-cgi.sock;\n    fastcgi_index index.php;\n    include fastcgi_params;\n    set \$real_script_name \$fastcgi_script_name;\n    if (\$fastcgi_script_name ~ \"^(.+?\.php)(/.+)\$\") {\n      set \$real_script_name \$1;\n      #set \$path_info \$2;\n    }\n    fastcgi_param SCRIPT_FILENAME \$document_root\$real_script_name;\n    fastcgi_param SCRIPT_NAME \$real_script_name;\n    #fastcgi_param PATH_INFO \$path_info;\n  }")
-    [ "${NGX_FLAG}" == 'php' -a "${rewrite}" == "pathinfo" ] && NGX_CONF=$(echo -e "location / {\n    if (!-e \$request_filename) {\n      rewrite ^(.*)\$ /index.php?s=\$1 last;\n      break;\n    }\n  }\n\n  location ~ [^/]\.php(/|$) {\n    #fastcgi_pass remote_php_ip:9000;\n    fastcgi_pass unix:/dev/shm/php-cgi.sock;\n    fastcgi_index index.php;\n    include fastcgi.conf;\n    fastcgi_split_path_info ^(.+?\.php)(/.*)\$;\n    set \$path_info \$fastcgi_path_info;\n    fastcgi_param PATH_INFO \$path_info;\n    try_files \$fastcgi_script_name =404;\n  }")
+    [ "${NGX_FLAG}" == 'php' ] && [[ "${rewrite}" =~ ^thinkphp$|^pathinfo$ ]] && NGX_CONF=$(echo -e "location ~ [^/]\.php(/|\$) {\n    try_files \$uri =404;\n    #fastcgi_pass remote_php_ip:9000;\n    fastcgi_pass unix:/dev/shm/php-cgi.sock;\n    fastcgi_index index.php;\n    include fastcgi.conf;\n    set \$real_script_name \$fastcgi_script_name;\n    if (\$fastcgi_script_name ~ \"^(.+?\.php)(/.+)\$\") {\n      set \$real_script_name \$1;\n      set \$path_info \$2;\n    }\n    fastcgi_param SCRIPT_FILENAME \$document_root\$real_script_name;\n    fastcgi_param SCRIPT_NAME \$real_script_name;\n    fastcgi_param PATH_INFO \$path_info;\n  }")
     [ "${NGX_FLAG}" == 'php' -a "${rewrite}" == "typecho" ] && NGX_CONF=$(echo -e "location ~ .*\.php(\/.*)*\$ {\n    #fastcgi_pass remote_php_ip:9000;\n    fastcgi_pass unix:/dev/shm/php-cgi.sock;\n    fastcgi_index index.php;\n    include fastcgi.conf;\n    set \$path_info \"\";\n    set \$real_script_name \$fastcgi_script_name;\n    if (\$fastcgi_script_name ~ \"^(.+?\.php)(/.+)\$\") {\n      set \$real_script_name \$1;\n      set \$path_info \$2;\n    }\n    fastcgi_param SCRIPT_FILENAME \$document_root\$real_script_name;\n    fastcgi_param SCRIPT_NAME \$real_script_name;\n    fastcgi_param PATH_INFO \$path_info;\n  }")
     if [[ ! "${rewrite}" =~ ^magento2$|^pathinfo$ ]]; then
       if [ -e "config/${rewrite}.conf" ]; then
@@ -537,7 +539,7 @@ EOF
   if [ $? == 0 ]; then
     echo "Reload Nginx......"
     ${web_install_dir}/sbin/nginx -s reload
-    /etc/init.d/tomcat restart
+    service tomcat restart
   else
     rm -f ${web_install_dir}/conf/vhost/${domain}.conf
     echo "Create virtualhost ... [${CFAILURE}FAILED${CEND}]"
@@ -569,7 +571,7 @@ EOF
   [ -z "$(grep -o "vhost-${domain};" ${tomcat_install_dir}/conf/server.xml)" ] && sed -i "s@vhost-localhost;@&\n      \&vhost-${domain};@" ${tomcat_install_dir}/conf/server.xml
 
   echo
-  /etc/init.d/tomcat restart
+  service tomcat restart
 
   printf "
 #######################################################################
@@ -693,8 +695,7 @@ Apache_log() {
 }
 
 Create_apache_conf() {
-  if [ "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '4' ]; then
-    Apache_grant='Require all granted'
+  if [ "${Apache_flag}" == '24' ]; then
     if [ -e "/dev/shm/php-cgi.sock" ] && [ -n "`grep -E ^LoadModule.*mod_proxy_fcgi.so ${apache_install_dir}/conf/httpd.conf`" ]; then
       Apache_fcgi=$(echo -e "<Files ~ (\\.user.ini|\\.htaccess|\\.git|\\.svn|\\.project|LICENSE|README.md)\$>\n    Order allow,deny\n    Deny from all\n  </Files>\n  <FilesMatch \\.php\$>\n    SetHandler \"proxy:unix:/dev/shm/php-cgi.sock|fcgi://localhost\"\n  </FilesMatch>")
     fi
@@ -815,8 +816,7 @@ EOF
   fi
 
   # Apache
-  if [ "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '4' ];then
-    Apache_grant='Require all granted'
+  if [ "${Apache_flag}" == '24' ]; then
     if [ -e "/dev/shm/php-cgi.sock" ] && [ -n "`grep -E ^LoadModule.*mod_proxy_fcgi.so ${apache_install_dir}/conf/httpd.conf`" ]; then
       Apache_fcgi=$(echo -e "<Files ~ (\\.user.ini|\\.htaccess|\\.git|\\.svn|\\.project|LICENSE|README.md)\$>\n    Order allow,deny\n    Deny from all\n  </Files>\n  <FilesMatch \\.php\$>\n    SetHandler \"proxy:unix:/dev/shm/php-cgi.sock|fcgi://localhost\"\n  </FilesMatch>")
     fi
@@ -1009,7 +1009,7 @@ Del_Tomcat_Vhost() {
       if [ -n "$(echo ${domain} | grep '.*\..*')" ] && [ -n "$(grep vhost-${domain} ${tomcat_install_dir}/conf/server.xml)" ]; then
         sed -i /vhost-${domain}/d ${tomcat_install_dir}/conf/server.xml
         rm -f ${tomcat_install_dir}/conf/vhost/${domain}.xml
-        /etc/init.d/tomcat restart
+        service tomcat restart
       fi
     else
       Domain_List=$(ls ${tomcat_install_dir}/conf/vhost | grep -v 'localhost.xml' | sed "s@.xml@@g")
@@ -1025,7 +1025,7 @@ Del_Tomcat_Vhost() {
             if [ -n "$(grep vhost-${domain} ${tomcat_install_dir}/conf/server.xml)" ]; then
               sed -i /vhost-${domain}/d ${tomcat_install_dir}/conf/server.xml
               rm -f ${tomcat_install_dir}/conf/vhost/${domain}.xml
-              /etc/init.d/tomcat restart
+              service tomcat restart
               while :; do echo
                 read -e -p "Do you want to delete Virtul Host directory? [y/n]: " Del_Vhost_wwwroot_flag
                 if [[ ! ${Del_Vhost_wwwroot_flag} =~ ^[y,n]$ ]]; then