1
0
Fork 0
mirror of https://github.com/myvesta/vesta synced 2025-08-05 22:34:41 -07:00

v-commander: inst-memchached and inst-redis

This commit is contained in:
myvesta 2023-03-23 14:14:40 +01:00 committed by GitHub
parent 172d66b4d2
commit e9ca648f12
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -82,6 +82,8 @@ myhelp() {
echo "inst p = install multi-php"
echo "inst pgw = install php-gate"
echo "inst r = install new Roundcube"
echo "inst memcached = install memcached"
echo "inst redis = install Redis"
echo "dis fb = stop and disable fail2ban"
echo "dis dove = stop and disable dovecot"
echo "dis spam = stop and disable spam"
@ -430,6 +432,46 @@ do
/root/install-phpgate.sh
fi
if [ "$answer" = 'inst memcache' ] || [ "$answer" = 'inst memcached' ] || [ "$answer" = 'INST MEMCACHE' ] || [ "$answer" = 'INST MEMCACHED' ]; then
echo "============================="
echo "== Installing memcached"
memory=$(grep 'MemTotal' /proc/meminfo |tr ' ' '\n' |grep [0-9])
apt-get update
apt-get -y install memcached
apt-get install $(systemctl --full --type service --all | grep "php...-fpm" | sed 's#●##g' | awk '{print $1}' | cut -c1-6 | xargs -n 1 printf "%s-memcache ")
apt-get install $(systemctl --full --type service --all | grep "php...-fpm" | sed 's#●##g' | awk '{print $1}' | cut -c1-6 | xargs -n 1 printf "%s-memcached ")
if [ $memory -lt 15000000 ]; then
sed -i "s/-m 64/-m 256/" /etc/memcached.conf
else
sed -i "s/-m 64/-m 1024/" /etc/memcached.conf
fi
systemctl restart memcached
echo "== memcached installed."
echo "-----------------------"
fi
if [ "$answer" = 'inst redis' ] || [ "$answer" = 'INST REDIS' ]; then
echo "============================="
echo "== Installing Redis"
memory=$(grep 'MemTotal' /proc/meminfo |tr ' ' '\n' |grep [0-9])
apt-get update
apt-get install -y redis-server
apt-get install $(systemctl --full --type service --all | grep "php...-fpm" | sed 's#●##g' | awk '{print $1}' | cut -c1-6 | xargs -n 1 printf "%s-redis ")
sed -i "s|^supervised no|supervised systemd|g" /etc/redis/redis.conf
sed -i "s|^save |# save |g" /etc/redis/redis.conf
if [ $memory -lt 15000000 ]; then
sed -i "s|^# maxmemory .*|maxmemory 256m|g" /etc/redis/redis.conf
else
sed -i "s|^# maxmemory .*|maxmemory 1g|g" /etc/redis/redis.conf
fi
sed -i "s|^# maxmemory-policy .*|maxmemory-policy allkeys-lru|g" /etc/redis/redis.conf
systemctl restart redis
redis-cli info memory
echo "== Redis installed."
echo "-------------------"
fi
if [ "$answer" = 'check fc' ] || [ "$answer" = 'CHECK FC' ]; then
echo "== Checking if FreshClam is up"
clamavup=$(/usr/local/vesta/bin/v-list-sys-services | grep 'clamav-daemon' | grep -c 'running')