0
Be the command:
top -o %MEM -b > file.txt
I would like you to file.txt only the values that are between two time periods, for example:
between 07 April 2017 07h and 07 April 2017 12h. Is it possible? This way I would have a file only with the entries that interest me.
I would like to store in an archive only entries that are between April 7, 2017 07h and April 7, 2017 12h!!!
I did not understand your question. The condition is related to some value issued by
top
?– Jefferson Quesado
Nao! would like to store in a file only the entries that are between April 7, 2017 07h and April 7, 2017 12h!!!
– Ed S
Where do you get this information from? You want to run the script only at these times according to the computer clock?
– Jefferson Quesado
it would be a time that I would inform him. I could use Unix time to make it easier. Because top -the %MEM -b > file.txt generates a lot that I don’t care about. I just want the information between dates that I enter!
– Ed S
It is possible to do this?
– Ed S
You want to make a schedule, which has nothing to do with function parameters. I found this font here in English that can help you: https://www.howtogeek.com/101288/how-to-schedule-tasks-on-linux-an-introduction-to-crontab-files/
– Jefferson Quesado
no! top -o %MEM -b > file.txt will generate a file with the use of memory and CPU with numerous days and times that do not interest me! i wanted to slice the file before it was generated to save only the above interval!
– Ed S
Then the exit from
top
do you have any relevant date information? If so, I would use agrep
to select– Jefferson Quesado
I don’t understand! I could give an example?
– Ed S
The problem is that it takes a long time to generate the file. I would like to tell the top command to only store it in the file between the periods I reported
– Ed S
cat /var/log/apache.log /var/log/anaconda.log | grep jeff
will only take the lines that havejeff
. Read aboutgrep
and pipe– Jefferson Quesado