Fix redis.conf permissions

This commit is contained in:
VirtuBox
2019-08-12 17:50:45 +02:00
parent efd3766e65
commit 398b0433dd

View File

@@ -1000,7 +1000,7 @@ class WOStackController(CementBaseController):
comment='MySQL optimization cronjob ' comment='MySQL optimization cronjob '
'added by WordOps') 'added by WordOps')
WOGit.add(self, ["/etc/mysql"], msg="Adding MySQL into Git") WOGit.add(self, ["/etc/mysql"], msg="Adding MySQL into Git")
WOService.reload_service(self, 'mysql') WOService.restart_service(self, 'mysql')
# create fail2ban configuration files # create fail2ban configuration files
if set(WOVariables.wo_fail2ban).issubset(set(apt_packages)): if set(WOVariables.wo_fail2ban).issubset(set(apt_packages)):
@@ -1721,7 +1721,7 @@ class WOStackController(CementBaseController):
Log.debug(self, "Calling pre_pref") Log.debug(self, "Calling pre_pref")
self.pre_pref(apt_packages) self.pre_pref(apt_packages)
if (apt_packages): if (apt_packages):
meminfo = (os.popen('cat /proc/meminfo ' meminfo = (os.popen('/bin/cat /proc/meminfo '
'| grep MemTotal').read()).split(":") '| grep MemTotal').read()).split(":")
memsplit = re.split(" kB", meminfo[1]) memsplit = re.split(" kB", meminfo[1])
wo_mem = int(memsplit[0]) wo_mem = int(memsplit[0])
@@ -1755,6 +1755,16 @@ class WOStackController(CementBaseController):
"maxmemory {0}" "maxmemory {0}"
.format .format
(int(wo_ram*1024*1024*0.1))) (int(wo_ram*1024*1024*0.1)))
else:
Log.debug(self, "Setting maxmemory variable to {0} "
"in redis.conf"
.format(int(wo_ram*1024*1024*0.2)))
WOFileUtils.searchreplace(self,
"/etc/redis/redis.conf",
"# maxmemory <bytes>",
"maxmemory {0}"
.format
(int(wo_ram*1024*1024*0.2)))
Log.debug( Log.debug(
self, "Setting maxmemory-policy variable to " self, "Setting maxmemory-policy variable to "
"allkeys-lru in redis.conf") "allkeys-lru in redis.conf")
@@ -1771,27 +1781,6 @@ class WOStackController(CementBaseController):
"/etc/redis/redis.conf", "/etc/redis/redis.conf",
"tcp-backlog 511", "tcp-backlog 511",
"tcp-backlog 32768") "tcp-backlog 32768")
WOService.restart_service(self, 'redis-server')
else:
Log.debug(self, "Setting maxmemory variable to {0} "
"in redis.conf"
.format(int(wo_ram*1024*1024*0.2)))
WOFileUtils.searchreplace(self,
"/etc/redis/redis.conf",
"# maxmemory <bytes>",
"maxmemory {0}"
.format
(int(wo_ram*1024*1024*0.1)))
Log.debug(
self, "Setting maxmemory-policy variable "
"to allkeys-lru in redis.conf")
WOFileUtils.searchreplace(self,
"/etc/redis/redis.conf",
"# maxmemory-policy "
"noeviction",
"maxmemory-policy "
"allkeys-lru")
WOFileUtils.chown(self, '/etc/redis/redis.conf', WOFileUtils.chown(self, '/etc/redis/redis.conf',
'redis', 'redis',
'redis', 'redis',