mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-11 15:56:11 +01:00
centralized execution ph1
This commit is contained in:
@@ -39,7 +39,7 @@ class ProcessUtilities:
|
||||
command = "sudo /usr/local/lsws/bin/lswsctrl restart"
|
||||
|
||||
cmd = shlex.split(command)
|
||||
res = subprocess.call(cmd)
|
||||
res = ProcessUtilities.executioner(cmd)
|
||||
|
||||
if res == 0:
|
||||
return 1
|
||||
@@ -58,7 +58,7 @@ class ProcessUtilities:
|
||||
command = "sudo /usr/local/lsws/bin/lswsctrl stop"
|
||||
|
||||
cmd = shlex.split(command)
|
||||
res = subprocess.call(cmd)
|
||||
res = ProcessUtilities.executioner(cmd)
|
||||
|
||||
if res == 0:
|
||||
return 1
|
||||
@@ -68,17 +68,6 @@ class ProcessUtilities:
|
||||
except subprocess.CalledProcessError, msg:
|
||||
logging.writeToFile(str(msg) + "[stopLitespeed]")
|
||||
|
||||
@staticmethod
|
||||
def executioner(command):
|
||||
try:
|
||||
res = subprocess.call(shlex.split(command))
|
||||
if res == 0:
|
||||
return 1
|
||||
else:
|
||||
return 0
|
||||
except BaseException, msg:
|
||||
return 0
|
||||
|
||||
@staticmethod
|
||||
def killLiteSpeed():
|
||||
try:
|
||||
@@ -118,7 +107,7 @@ class ProcessUtilities:
|
||||
def containerCheck():
|
||||
try:
|
||||
command = 'sudo cat /etc/cgrules.conf'
|
||||
result = subprocess.call(shlex.split(command))
|
||||
result = ProcessUtilities.executioner(shlex.split(command))
|
||||
if result == 1:
|
||||
return 0
|
||||
else:
|
||||
@@ -126,5 +115,24 @@ class ProcessUtilities:
|
||||
except BaseException:
|
||||
return 0
|
||||
|
||||
@staticmethod
|
||||
def executioner(command):
|
||||
try:
|
||||
res = subprocess.call(shlex.split(command))
|
||||
if res == 0:
|
||||
return 1
|
||||
else:
|
||||
return 0
|
||||
except BaseException, msg:
|
||||
return 0
|
||||
|
||||
@staticmethod
|
||||
def outputExecutioner(command):
|
||||
return subprocess.check_output(shlex.split(command))
|
||||
|
||||
@staticmethod
|
||||
def popenExecutioner(command):
|
||||
return subprocess.Popen(shlex.split(command))
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user