diff --git a/bin/easyengine b/bin/easyengine index 7b6bd050..47699deb 100644 --- a/bin/easyengine +++ b/bin/easyengine @@ -684,6 +684,11 @@ elif [ "$EE_FIRST" = "cd" ]; then ee_site_cd fi +# EasyEngine clean +elif [ "$EE_FIRST" = "clean" ]; then + ee_mod_cache_clean ${@:2} || ee_lib_error "Unable to clean cache = " $? + + # EasyEngine update elif [ "$EE_FIRST" = "update" ]; then ee_lib_echo "Please set/use following alias to update EasyEngine (ee)" diff --git a/src/modules/stack/ee_mod_cache_clean.sh b/src/modules/stack/ee_mod_cache_clean.sh index 599f95e0..939feb26 100644 --- a/src/modules/stack/ee_mod_cache_clean.sh +++ b/src/modules/stack/ee_mod_cache_clean.sh @@ -3,33 +3,42 @@ function ee_mod_cache_clean() { - for ee_param in $@ ; do - - if [ "$ee_param" = "" ] || [ "$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 - fi - - if [ "$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 - fi - - if [ "$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 = " $? - - fi - done + # ee clean + 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 + 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 = " $? + fi + done + }