mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-10 15:26:13 +01:00
centralized execution ph1
This commit is contained in:
@@ -162,7 +162,7 @@ def saveWebsiteLimits(request):
|
||||
cgrules = '/etc/cgrules.conf'
|
||||
enforceString = '{} cpu,memory,blkio,net_cls {}/\n'.format(website.externalApp, website.externalApp)
|
||||
|
||||
cgrulesData = subprocess.check_output(shlex.split('sudo cat /etc/cgrules.conf')).splitlines()
|
||||
cgrulesData = ProcessUtilities.outputExecutioner(shlex.split('sudo cat /etc/cgrules.conf')).splitlines()
|
||||
|
||||
writeToFile = open(cgrulesTemp, 'w')
|
||||
|
||||
@@ -219,7 +219,7 @@ def saveWebsiteLimits(request):
|
||||
cgrulesTemp = "/home/cyberpanel/" + str(randint(1000, 9999))
|
||||
cgrules = '/etc/cgrules.conf'
|
||||
|
||||
cgrulesData = subprocess.check_output(shlex.split('sudo cat /etc/cgrules.conf')).splitlines()
|
||||
cgrulesData = ProcessUtilities.outputExecutioner(shlex.split('sudo cat /etc/cgrules.conf')).splitlines()
|
||||
|
||||
writeToFile = open(cgrulesTemp, 'w')
|
||||
|
||||
@@ -293,7 +293,7 @@ def getUsageData(request):
|
||||
if type == 'memory':
|
||||
|
||||
command = 'sudo cat /sys/fs/cgroup/memory/' + website.externalApp + '/memory.usage_in_bytes'
|
||||
output = str(subprocess.check_output(command, shell=True))
|
||||
output = str(ProcessUtilities.outputExecutioner(command, shell=True))
|
||||
finalData['memory'] = int(float(output)/float(1024 * 1024))
|
||||
|
||||
elif type == 'io':
|
||||
@@ -305,7 +305,7 @@ def getUsageData(request):
|
||||
os.mkdir(path)
|
||||
|
||||
command = 'sudo cat /sys/fs/cgroup/blkio/' + website.externalApp + '/blkio.throttle.io_service_bytes'
|
||||
output = subprocess.check_output(command, shell=True).splitlines()
|
||||
output = ProcessUtilities.outputExecutioner(command, shell=True).splitlines()
|
||||
|
||||
readCurrent = output[0].split(' ')[2]
|
||||
writeCurrent = output[1].split(' ')[2]
|
||||
@@ -333,7 +333,7 @@ def getUsageData(request):
|
||||
finalData['writeRate'] = 0
|
||||
except:
|
||||
command = "sudo top -b -n 1 -u " + website.externalApp + " | awk 'NR>7 { sum += $9; } END { print sum; }'"
|
||||
output = str(subprocess.check_output(command, shell=True))
|
||||
output = str(ProcessUtilities.outputExecutioner(command, shell=True))
|
||||
|
||||
finalData = {}
|
||||
if len(output) == 0:
|
||||
|
||||
Reference in New Issue
Block a user