harshadyeola
10 years ago
6 changed files with 81 additions and 75 deletions
@ -0,0 +1,41 @@ |
|||
# Clean NGINX FastCGI, Memcache, OPcache cache |
|||
|
|||
function ee_mod_clean() |
|||
{ |
|||
if [ "$@" = "" ] || [ "$@" = "fastcgi" ]; then |
|||
EE_CLEAN_FASTCGI="fastcgi" |
|||
elif [ "$@" = "memcache" ]; then |
|||
EE_CLEAN_MEMCACHE="memcache" |
|||
elif [ "$@" = "opcache" ]; then |
|||
EE_CLEAN_OPCACHE="opcache" |
|||
elif [ "$@" = "all" ]; then |
|||
EE_CLEAN_FASTCGI="fastcgi" |
|||
EE_CLEAN_MEMCACHE="memcache" |
|||
EE_CLEAN_OPCACHE="opcache" |
|||
fi |
|||
|
|||
if [ "$EE_CLEAN_FASTCGI" = "fastcgi" ]; then |
|||
ee_lib_echo "Cleaning NGINX 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 = " $? |
|||
fi |
|||
fi |
|||
|
|||
if [ "$EE_CLEAN_MEMCACHE" = "memcache" ]; then |
|||
dpkg --get-selections | grep -v deinstall | grep memcached &>> $EE_COMMAND_LOG \ |
|||
|| ee_lib_error "Memcache not installed, exit status = " $? |
|||
|
|||
if [ $? -eq 0 ]; then |
|||
ee_lib_echo "Cleaning Memcached, please wait..." |
|||
service memcached restart &>> $EE_COMMAND_LOG \ |
|||
|| ee_lib_error "Unable to restart memcached, exit status = " $? |
|||
fi |
|||
fi |
|||
|
|||
if [ "$EE_CLEAN_OPCACHE" = "memcache" ]; then |
|||
ee_lib_echo "Cleaning Memcached, 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 |
|||
} |
@ -1,48 +0,0 @@ |
|||
# Clean all cache |
|||
|
|||
function ee_mod_cache_clean() |
|||
{ |
|||
|
|||
# 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 || 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 || ee_lib_error "Unable to clean FastCGI cache, exit status = " $? |
|||
ee_lib_echo "Ok." |
|||
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 || ee_lib_error "Unable to clean memcache, exit status = " $? |
|||
ee_lib_echo "Ok." |
|||
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 = " $? |
|||
ee_lib_echo "Ok." |
|||
|
|||
else |
|||
ee_lib_error "Invalid option selected, choose correct option, exit status = " $? |
|||
fi |
|||
done |
|||
|
|||
|
|||
} |
@ -0,0 +1,14 @@ |
|||
# Setup Percona repository |
|||
|
|||
function ee_mod_repo_mysql() |
|||
{ |
|||
# Add Percona repository |
|||
ee_lib_echo "Adding Percona repository, please wait..." |
|||
echo "deb http://repo.percona.com/apt $(lsb_release -sc) main" > /etc/apt/sources.list.d/percona-$(lsb_release -sc).list \ |
|||
|| ee_lib_error "Unable to add Percona repository, exit status = " $? |
|||
|
|||
# Fetch and install Percona GnuPG key |
|||
gpg --keyserver hkp://keys.gnupg.net --recv-keys 1C4CBDCDCD2EFD2A && \ |
|||
gpg -a --export CD2EFD2A | sudo apt-key add - \ |
|||
|| ee_lib_error "Unable to add Percona GnuPG key, exit status = " $? |
|||
} |
Loading…
Reference in new issue