Fix ps -s output

This commit is contained in:
Oleksii Shevchuk 2017-03-20 18:07:22 +02:00 committed by Oleksii Shevchuk
parent c88b5a20e8
commit 8caf550114
2 changed files with 6 additions and 2 deletions

View File

@ -50,7 +50,7 @@ class LastModule(PupyModule):
if record['end'] == -1:
if record['user'] == 'root':
color = 'lightred'
elif record['duration'] < 24*60*60:
elif record['duration'] < 60*60:
color = 'lightgreen'
elif record['duration'] > 7*24*60*60:
color = 'cyan'

View File

@ -37,6 +37,9 @@ def gen_colinfo(data):
def gen_columns(record, colinfo):
columns = {}
if type(record['cmdline']) is not list:
record['cmdline'] = [record['cmdline']]
columns['name'] = record.get('name') or '?'
columns['cmdline'] = ' '.join([
x for x in record['cmdline'][1:] if x.strip()
@ -97,8 +100,9 @@ def print_psinfo(fout, pupyps, data, colinfo, width=80, sections=[]):
) else ( 1 if (y in keys and not x in keys) else cmp(x, y))
for pid, info in data.iteritems():
fout.write('\n --- PID: {} ---- \n\n'.format(pid))
if sections is not None:
fout.write('\n --- PID: {} ---- \n\n'.format(pid))
infosecs = {
'general': []
}