I’m looking for some help with parsing ‘Duration’ from output from scontrol
1
scontrol show res root_89
ReservationName=root_89 StartTime=2012-11-07T14:22:21 EndTime=2012-11-08T16:22:21 Duration=02:00:00
Nodes=host NodeCnt=1 Features=(null) PartitionName=(null) Flags=SPEC_NODES
Users=root Accounts=(null) Licenses=(null) State=ACTIVE
2
scontrol show res root_95
ReservationName=root_95 StartTime=2013-02-06T16:00:00 EndTime=2013-02-10T06:40:00 Duration=3-14:40:00
Nodes=host NodeCnt=1 Features=(null) PartitionName=(null) Flags=SPEC_NODES
Users=root Accounts=(null) Licenses=(null) State=INACTIVE
As you can see if reservation is really long Duration output is messed up And i’m looking for format ‘xxHH:mm:ss’
this line should work for your case:
Note that I was a bit lazy, so I used grep to filter out the duration value. it could be done with awk, to save a process. if performance is not the problem in your case, you can keep the grep there.
test