Merge "Add option to swift-oldies to only print pids"
This commit is contained in:
commit
817528e8ae
@ -26,6 +26,9 @@ Lists old Swift processes.
|
||||
parser.add_option('-a', '--age', dest='hours', type='int', default=720,
|
||||
help='look for processes at least HOURS old; '
|
||||
'default: 720 (30 days)')
|
||||
parser.add_option('-p', '--pids', action='store_true',
|
||||
help='only print the pids found; for example, to pipe '
|
||||
'to xargs kill')
|
||||
(options, args) = parser.parse_args()
|
||||
|
||||
listing = []
|
||||
@ -68,6 +71,10 @@ Lists old Swift processes.
|
||||
if not listing:
|
||||
sys.exit()
|
||||
|
||||
if options.pids:
|
||||
for hours, pid, args in listing:
|
||||
print(pid)
|
||||
else:
|
||||
hours_len = len('Hours')
|
||||
pid_len = len('PID')
|
||||
args_len = len('Command')
|
||||
|
Loading…
x
Reference in New Issue
Block a user