From 5dbf3d9651f5ab36cfc8320c8b6f29f36beba277 Mon Sep 17 00:00:00 2001 From: harshadyeola Date: Mon, 15 Sep 2014 19:44:13 +0530 Subject: [PATCH] ee cd --- src/modules/site/ee_site_cd.sh | 1 + src/modules/stack/ee_mod_cache_clean.sh | 66 +++++++++++++------------ 2 files changed, 36 insertions(+), 31 deletions(-) diff --git a/src/modules/site/ee_site_cd.sh b/src/modules/site/ee_site_cd.sh index aecb4b45..e9bb486a 100644 --- a/src/modules/site/ee_site_cd.sh +++ b/src/modules/site/ee_site_cd.sh @@ -4,4 +4,5 @@ function ee_site_cd() { cd $(grep root /etc/nginx/sites-available/$EE_DOMAIN | awk '{ print $2 }' | sed 's/;//g') \ || ee_lib_error "Unable to change directory for $EE_DOMAIN, exit status = " $? + exec bash } \ No newline at end of file diff --git a/src/modules/stack/ee_mod_cache_clean.sh b/src/modules/stack/ee_mod_cache_clean.sh index 939feb26..54cfb2f8 100644 --- a/src/modules/stack/ee_mod_cache_clean.sh +++ b/src/modules/stack/ee_mod_cache_clean.sh @@ -4,41 +4,45 @@ function ee_mod_cache_clean() { # ee clean - if [ $# -eq 0 ]; then + if [ $# -eq 0 ]; then + ee_lib_echo "Cleaning FastCGI cache, please wait .... " + if [ -d /var/run/nginx-cache/ ]; then + rm -rf /var/run/nginx-cache/* &>> $EE_COMMAND_LOG || ee_lib_error "Unable to clean FastCGI cache, exit status = " $? + ee_lib_echo "Ok." + fi + fi + + # ee clean fastcgi|memcache|opcache + for ee_param in $@ ; do + + if [ "$ee_param" = "fastcgi" ] || [ "$ee_param" = "all" ]; then + # Clean fastcgi cache ee_lib_echo "Cleaning FastCGI cache, please wait .... " if [ -d /var/run/nginx-cache/ ]; then - rm -rf /var/run/nginx-cache/* &>> $EE_COMMAND_LOG + rm -rf /var/run/nginx-cache/* &>> $EE_COMMAND_LOG || ee_lib_error "Unable to clean FastCGI cache, exit status = " $? + ee_lib_echo "Ok." fi - fi - - # ee clean fastcgi|memcache|opcache - for ee_param in $@ ; do - - if [ "$ee_param" = "fastcgi" ] || [ "$ee_param" = "all" ]; then - # Clean fastcgi cache - ee_lib_echo "Cleaning FastCGI cache, please wait .... " - if [ -d /var/run/nginx-cache/ ]; then - rm -rf /var/run/nginx-cache/* &>> $EE_COMMAND_LOG - fi - elif [ "$ee_param" = "memcache" ] || [ "$ee_param" = "all" ]; then - # Clean memcache - ee_lib_echo "Cleaning Memcache, please wait .... " - dpkg --get-selections | grep -v deinstall | grep memcached &>> $EE_COMMAND_LOG \ - || ee_lib_error "Memcache not installed, exit status = " $? - if [ $? -eq 0 ];then - service memcached restart &>> $EE_COMMAND_LOG - fi - - elif [ "$ee_param" = "opcache" ] || [ "$ee_param" = "all" ]; then - # Clean opcache - ee_lib_echo "Cleaning OPcache, please wait .... " - wget --no-check-certificate --spider -q https://127.0.0.1:22222/cache/opcache/opgui.php?page=reset \ - || ee_lib_error "Unable to clean OPcache, exit status = " $? - - else - ee_lib_error "Invalid option selected, choose correct option, exit status = " $? + elif [ "$ee_param" = "memcache" ] || [ "$ee_param" = "all" ]; then + # Clean memcache + ee_lib_echo "Cleaning Memcache, please wait .... " + dpkg --get-selections | grep -v deinstall | grep memcached &>> $EE_COMMAND_LOG \ + || ee_lib_error "Memcache not installed, exit status = " $? + if [ $? -eq 0 ];then + service memcached restart &>> $EE_COMMAND_LOG || ee_lib_error "Unable to clean memcache, exit status = " $? + ee_lib_echo "Ok." fi - done + + elif [ "$ee_param" = "opcache" ] || [ "$ee_param" = "all" ]; then + # Clean opcache + ee_lib_echo "Cleaning OPcache, please wait .... " + wget --no-check-certificate --spider -q https://127.0.0.1:22222/cache/opcache/opgui.php?page=reset \ + || ee_lib_error "Unable to clean OPcache, exit status = " $? + ee_lib_echo "Ok." + + else + ee_lib_error "Invalid option selected, choose correct option, exit status = " $? + fi + done }