Browse Source

Use systemctl for hhvm

lj2007331@gmail.com 6 years ago
parent
commit
ace6c3447d
5 changed files with 47 additions and 26 deletions
  1. 3 0
      README.md
  2. 7 7
      backup.sh
  3. 27 11
      include/hhvm_CentOS.sh
  4. 2 0
      uninstall.sh
  5. 8 8
      versions.txt

+ 3 - 0
README.md

@@ -105,6 +105,9 @@ service php-fpm {start|stop|restart|reload|status}
 ```
 HHVM:
 ```bash
+#centos7
+systemctl {start|stop|status|restart} hhvm
+#centos6
 service supervisord {start|stop|status|restart|reload}
 ```
 Apache:

+ 7 - 7
backup.sh

@@ -29,8 +29,8 @@ DB_Remote_BK() {
     ./db_bk.sh ${D}
     DB_GREP="DB_${D}_`date +%Y%m%d`"
     DB_FILE=`ls -lrt ${backup_dir} | grep ${DB_GREP} | tail -1 | awk '{print $NF}'`
-    echo "file:::${backup_dir}/${DB_FILE} ${backup_dir} push" >> config_bakcup.txt
-    echo "com:::[ -e "${backup_dir}/${DB_FILE}" ] && rm -rf ${backup_dir}/DB_${D}_$(date +%Y%m%d --date="${expired_days} days ago")_*.tgz" >> config_bakcup.txt
+    echo "file:::${backup_dir}/${DB_FILE} ${backup_dir} push" >> config_backup.txt
+    echo "com:::[ -e "${backup_dir}/${DB_FILE}" ] && rm -rf ${backup_dir}/DB_${D}_$(date +%Y%m%d --date="${expired_days} days ago")_*.tgz" >> config_backup.txt
   done
 }
 
@@ -96,10 +96,10 @@ WEB_Remote_BK() {
       ./website_bk.sh $W
       Web_GREP="Web_${W}_`date +%Y%m%d`"
       Web_FILE=`ls -lrt ${backup_dir} | grep ${Web_GREP} | tail -1 | awk '{print $NF}'`
-      echo "file:::${backup_dir}/$Web_FILE ${backup_dir} push" >> config_bakcup.txt
-      echo "com:::[ -e "${backup_dir}/$Web_FILE" ] && rm -rf ${backup_dir}/Web_${W}_$(date +%Y%m%d --date="${expired_days} days ago")_*.tgz" >> config_bakcup.txt
+      echo "file:::${backup_dir}/$Web_FILE ${backup_dir} push" >> config_backup.txt
+      echo "com:::[ -e "${backup_dir}/$Web_FILE" ] && rm -rf ${backup_dir}/Web_${W}_$(date +%Y%m%d --date="${expired_days} days ago")_*.tgz" >> config_backup.txt
     else
-      echo "file:::${wwwroot_dir}/$W ${backup_dir} push" >> config_bakcup.txt
+      echo "file:::${wwwroot_dir}/$W ${backup_dir} push" >> config_backup.txt
     fi
   done
 }
@@ -183,10 +183,10 @@ do
     [ -n "`echo ${backup_content} | grep -ow web`" ] && WEB_Local_BK
   fi
   if [ "${DEST}" == 'remote' ]; then
-    echo "com:::[ ! -e "${backup_dir}" ] && mkdir -p ${backup_dir}" > config_bakcup.txt
+    echo "com:::[ ! -e "${backup_dir}" ] && mkdir -p ${backup_dir}" > config_backup.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
+    ./mabs.sh -c config_backup.txt -T -1 | tee -a mabs.log
   fi
   if [ "${DEST}" == 'oss' ]; then
     [ -n "`echo ${backup_content} | grep -ow db`" ] && DB_OSS_BK

+ 27 - 11
include/hhvm_CentOS.sh

@@ -136,13 +136,28 @@ EOF
 
   rm -rf /etc/ld.so.conf.d/*_64.conf
   ldconfig
-  # Supervisor
-  yum -y install python-setuptools
-  ping pypi.python.org -c 4 >/dev/null 2>&1
-  easy_install supervisor
-  echo_supervisord_conf > /etc/supervisord.conf
-  sed -i 's@pidfile=/tmp/supervisord.pid@pidfile=/var/run/supervisord.pid@' /etc/supervisord.conf
-  [ -z "$(grep 'program:hhvm' /etc/supervisord.conf)" ] && cat >> /etc/supervisord.conf << EOF
+  if [ -e /bin/systemctl ]; then
+    cat > /lib/systemd/system/hhvm.service << EOF
+[Unit]
+Description=HHVM HipHop Virtual Machine (FCGI)
+After=network.target nginx.service
+
+[Service]
+ExecStart=/usr/local/bin/hhvm --mode server --user ${run_user} --config /etc/hhvm/server.ini --config /etc/hhvm/php.ini --config /etc/hhvm/config.hdf
+
+[Install]
+WantedBy=multi-user.target
+EOF
+    systemctl enable hhvm
+    systemctl start hhvm
+  else
+    # Supervisor
+    yum -y install python-setuptools
+    ping pypi.python.org -c 4 >/dev/null 2>&1
+    easy_install supervisor
+    echo_supervisord_conf > /etc/supervisord.conf
+    sed -i 's@pidfile=/tmp/supervisord.pid@pidfile=/var/run/supervisord.pid@' /etc/supervisord.conf
+    [ -z "$(grep 'program:hhvm' /etc/supervisord.conf)" ] && cat >> /etc/supervisord.conf << EOF
 [program:hhvm]
 command=/usr/bin/hhvm --mode server --user ${run_user} --config /etc/hhvm/server.ini --config /etc/hhvm/php.ini --config /etc/hhvm/config.hdf
 numprocs=1 ; number of processes copies to start (def 1)
@@ -151,8 +166,9 @@ autostart=true ; start at supervisord start (default: true)
 autorestart=unexpected ; whether/when to restart (default: unexpected)
 stopwaitsecs=10 ; max num secs to wait b4 SIGKILL (default 10)
 EOF
-  /bin/cp ${oneinstack_dir}/init.d/Supervisor-init-CentOS /etc/init.d/supervisord
-  chmod +x /etc/init.d/supervisord
-  chkconfig supervisord on
-  service supervisord start
+    /bin/cp ${oneinstack_dir}/init.d/Supervisor-init-CentOS /etc/init.d/supervisord
+    chmod +x /etc/init.d/supervisord
+    chkconfig supervisord on
+    service supervisord start
+  fi
 }

+ 2 - 0
uninstall.sh

@@ -174,11 +174,13 @@ Print_HHVM() {
   [ -e "/usr/bin/hhvm" ] && echo "/usr/bin/hhvm"
   [ -e "/etc/hhvm" ] && echo "/etc/hhvm"
   [ -e "/var/log/hhvm" ] && echo "/var/log/hhvm"
+  [ -e "/lib/systemd/system/hhvm.service" ] && echo "/lib/systemd/system/hhvm.service"
   [ -e "/etc/supervisord.conf" ] && echo "/etc/supervisord.conf"
   [ -e "/etc/init.d/supervisord" ] && echo "/etc/init.d/supervisord"
 }
 
 Uninstall_HHVM() {
+  [ -e "/lib/systemd/system/hhvm.service" ] && { systemctl disable hhvm > /dev/null 2>&1; rm -rf /lib/systemd/system/hhvm.service; }
   [ -e "/etc/init.d/supervisord" ] && { service supervisord stop > /dev/null 2>&1; rm -rf /etc/supervisord.conf /etc/init.d/supervisord; }
   [ -e "/usr/bin/hhvm" ] && { rpm -e hhvm; rm -rf /etc/hhvm /var/log/hhvm /usr/bin/hhvm; echo "${CMSG}HHVM uninstall completed! ${CEND}"; }
 }

+ 8 - 8
versions.txt

@@ -40,15 +40,15 @@ pgsql_ver=10.4
 mongodb_ver=4.0.0
 
 # JDK
-jdk10_ver=10.0.1
-jdk18_ver=1.8.0_172
+jdk10_ver=10.0.2
+jdk18_ver=1.8.0_181
 jdk17_ver=1.7.0_80
 jdk16_ver=1.6.0_45
 
 # PHP
-php72_ver=7.2.7
-php71_ver=7.1.19
-php70_ver=7.0.30
+php72_ver=7.2.8
+php71_ver=7.1.20
+php70_ver=7.0.31
 php56_ver=5.6.36
 php55_ver=5.5.38
 php54_ver=5.4.45
@@ -61,7 +61,7 @@ mcrypt_ver=2.6.8
 mhash_ver=0.9.9.9
 libsodium_ver=1.0.16
 argon2_ver=20171227
-imagemagick_ver=6.9.10-5
+imagemagick_ver=6.9.10-7
 imagick_ver=3.4.3
 graphicsmagick_ver=1.3.28
 gmagick_for_php7_ver=2.0.5RC1
@@ -79,7 +79,7 @@ pureftpd_ver=1.0.47
 
 # Redis
 redis_ver=4.0.10
-redis_pecl_ver=4.0.2
+redis_pecl_ver=4.1.0
 
 # Memcached
 memcached_ver=1.5.9
@@ -89,7 +89,7 @@ memcached_pecl_php7_ver=3.0.4
 memcache_pecl_ver=3.0.8
 
 # MongoDB
-mongodb_pecl_ver=1.5.0
+mongodb_pecl_ver=1.5.1
 mongo_pecl_ver=1.6.16
 
 # phpMyadmin