I want to obtain all the process that are running in the system, but only from yesterday.
I am using this, ps -eo etime,pid
but i need only list the process from yesterday, any idea?
INFO: active from yesterday, process actually running from yesterday
Thanks in advance
CodePudding user response:
If you want all the pids that have been running for more than 1 day but less than 2:
ps -e -o pid= -o etime= | sed 's/^ *//' | awk -F '[ -] ' 'NF>2 && $2==1 {print $1}'
if you want just more than 1 day, change it to $2>=1
CodePudding user response:
It is not clear what exactly you need But if you needed it from a specific time, just add it to crontab. For example: 0 2 * * * ps -eo etime,pid>/tmp/processes.txt
This way you will have a snapshot from the processes running on 2:00
If you didnt mean that please be more specific of what exactly do you need