1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-07-15 01:24:29 +02:00

doc updates and tty fix

This commit is contained in:
Kelly Brazil
2019-11-07 15:33:12 -08:00
parent 4802222ad5
commit 89973f4162

View File

@ -7,60 +7,74 @@ Usage:
- ef - ef
- axu - axu
Example: Examples:
$ ps -ef | jc --ps -p $ ps -ef | jc --ps -p
[ [
{
"uid": "root",
"pid": 1,
"ppid": 0,
"c": 0,
"stime": "Nov01",
"tty": null,
"time": "00:00:11",
"cmd": "/usr/lib/systemd/systemd --switched-root --system --deserialize 22"
},
{
"uid": "root",
"pid": 2,
"ppid": 0,
"c": 0,
"stime": "Nov01",
"tty": null,
"time": "00:00:00",
"cmd": "[kthreadd]"
},
{
"uid": "root",
"pid": 4,
"ppid": 2,
"c": 0,
"stime": "Nov01",
"tty": null,
"time": "00:00:00",
"cmd": "[kworker/0:0H]"
},
... ...
]
$ ps -ef | jc --ps -p -r
[
{ {
"uid": "root", "uid": "root",
"pid": "545", "pid": "1",
"ppid": "1", "ppid": "0",
"c": "0", "c": "0",
"stime": "Oct21", "stime": "Nov01",
"tty": "?", "tty": "?",
"time": "00:00:03", "time": "00:00:11",
"cmd": "/usr/lib/systemd/systemd-journald" "cmd": "/usr/lib/systemd/systemd --switched-root --system --deserialize 22"
}, },
{ {
"uid": "root", "uid": "root",
"pid": "566", "pid": "2",
"ppid": "1", "ppid": "0",
"c": "0", "c": "0",
"stime": "Oct21", "stime": "Nov01",
"tty": "?", "tty": "?",
"time": "00:00:00", "time": "00:00:00",
"cmd": "/usr/sbin/lvmetad -f" "cmd": "[kthreadd]"
}, },
{ {
"uid": "root", "uid": "root",
"pid": "580", "pid": "4",
"ppid": "1",
"c": "0",
"stime": "Oct21",
"tty": "?",
"time": "00:00:00",
"cmd": "/usr/lib/systemd/systemd-udevd"
},
{
"uid": "root",
"pid": "659",
"ppid": "2", "ppid": "2",
"c": "0", "c": "0",
"stime": "Oct21", "stime": "Nov01",
"tty": "?", "tty": "?",
"time": "00:00:00", "time": "00:00:00",
"cmd": "[kworker/u257:0]" "cmd": "[kworker/0:0H]"
},
{
"uid": "root",
"pid": "666",
"ppid": "2",
"c": "0",
"stime": "Oct21",
"tty": "?",
"time": "00:00:00",
"cmd": "[hci0]"
}, },
... ...
] ]
@ -93,6 +107,10 @@ def process(proc_data):
except (ValueError): except (ValueError):
entry[key] = None entry[key] = None
if 'tty' in entry:
if entry['tty'] == '?':
entry['tty'] = None
return proc_data return proc_data