mirror of
https://github.com/YunoHost/moulinette.git
synced 2024-09-03 20:06:31 +02:00
check process ok
This commit is contained in:
parent
17ca215e3b
commit
21877f6e7b
2 changed files with 14 additions and 13 deletions
|
@ -1,4 +1,4 @@
|
||||||
glances:
|
glances:
|
||||||
command: service
|
status: service
|
||||||
tahoe-lafs:
|
tahoe-lafs:
|
||||||
command: ps aux | grep tahoe |grep -v grep
|
status: ps aux | grep tahoe |grep -v grep
|
||||||
|
|
|
@ -84,22 +84,23 @@ def process_stop(args):
|
||||||
else:
|
else:
|
||||||
raise YunoHostError(1, 'Stop : ' + args.title() + " " + _("failure"))
|
raise YunoHostError(1, 'Stop : ' + args.title() + " " + _("failure"))
|
||||||
|
|
||||||
|
|
||||||
def process_check(args):
|
def process_check(args):
|
||||||
with open('process.yml', 'r') as f:
|
with open('process.yml', 'r') as f:
|
||||||
process = yaml.load(f)
|
processes = yaml.load(f)
|
||||||
|
|
||||||
for i in process:
|
result = {}
|
||||||
cmd = process[i]['command']
|
for process, commands in processes.items():
|
||||||
if cmd == 'service':
|
if commands['status'] == 'service':
|
||||||
status = os.system("service " + i + " status")
|
cmd = "service " + process + " status"
|
||||||
else:
|
else:
|
||||||
status = os.system(cmd)
|
cmd = commands['status']
|
||||||
if status == 0:
|
|
||||||
return { i + " " + _("is up") }
|
|
||||||
else:
|
|
||||||
raise YunoHostError(1, i + " " + _("is down") )
|
|
||||||
|
|
||||||
|
if os.system(cmd + " > /dev/null 2>&1") == 0:
|
||||||
|
result.update({ process : _('Running') })
|
||||||
|
else:
|
||||||
|
result.update({ process : _('Down') })
|
||||||
|
|
||||||
|
return { 'Status' : result }
|
||||||
|
|
||||||
def monitor_info(memory=False, cpu=False, disk=False, ifconfig=False, uptime=False, public=False):
|
def monitor_info(memory=False, cpu=False, disk=False, ifconfig=False, uptime=False, public=False):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Add table
Reference in a new issue