Note:
I have an older version of ps
without the option to use -o etimes
to get the times in seconds. So the solution of list-processes-that-have-been-running-more-than-2-hours cannot be used directly here.
I want to list the process which are running for more than 3 hours. Below is the command which i am using to list the processes
Command
ps -Ao stime,etime,cmd --sort=start_time | grep "/home/mose/bin/hi.sh" | grep -v "grep"
Output
Jun06 1-03:36:53 /bin/ksh /home/mose/bin/hi.sh -j KendaEVALUATION_7 -o 220606
Jun06 1-03:36:53 /bin/ksh /home/mose/bin/hi.sh -j KendaEVALUATION_5 -o 220606
Jun06 1-03:36:53 /bin/ksh /home/mose/bin/hi.sh -j KendaEVALUATION_8 -o 220606
Jun06 1-03:36:53 /bin/ksh /home/mose/bin/hi.sh -j KendaEVALUATION_6 -o 220606
07:54 03:43:46 /bin/ksh /home/mose/bin/hi.sh -j Kenda -o 220607
08:01 03:36:54 /bin/ksh /home/mose/bin/hi.sh -j KendaWORKING_TIME_6 -o 220607
08:01 03:36:54 /bin/ksh /home/mose/bin/hi.sh -j KendaFRONTOFFICE_5 -o 220607
08:01 03:36:54 /bin/ksh /home/mose/bin/hi.sh -j KendaWORKING_TIME_4 -o 220607
08:01 03:36:54 /bin/ksh /home/mose/bin/hi.sh -j KendaWORKING_TIME_8 -o 220607
08:01 03:36:54 /bin/ksh /home/mose/bin/hi.sh -j KendaWORKING_TIME_5 -o 220607
08:01 03:36:54 /bin/ksh /home/mose/bin/hi.sh -j KendaWORKING_TIME_3 -o 220607
08:01 03:36:54 /bin/ksh /home/mose/bin/hi.sh -j KendaWORKING_TIME_2 -o 220607
08:01 03:36:54 /bin/ksh /home/mose/bin/hi.sh -j KendaWORKING_TIME_7 -o 220607
08:01 03:36:54 /bin/ksh /home/mose/bin/hi.sh -j KendaWORKING_TIME_1 -o 220607
08:30 03:07:01 /bin/ksh /home/mose/bin/hi.sh -j JituSUBT -o 220607
08:40 02:56:58 /bin/ksh /home/mose/bin/hi.sh -j JituREFRESH -o 220607
09:10 02:27:32 /bin/ksh /home/mose/bin/hi.sh -j KendaWOCAS -o 220607
09:56 01:41:33 /bin/ksh /home/mose/bin/hi.sh -j KendaBACKOFFICE_CCB_KUA_4 -o 220607
So from how can i list only the process which are running for more than 3 hours.
etime
as you have already used, notetimes
.etimes
doesn't seem to be available in "procps version 3.2.8", but is in "procps-ng version 3.3.9". Looking at the git tags and the Debian package, 3.3.9 seems to be from around 2014 already.