Hi Community,
i'd like to create a ssh Script that allow me to check if one File on a Unix System is older than 2 hours. The interpretation of the age can used by the Time-/Datestamp in the Filesystem.
Example-File: /var/log/debug/sendMails.log
Can anyone help me please?
Article Comments
Attention: This article is a record of a conversation with the Paessler support team. The information in this conversation is not updated to preserve the historical record. As a result, some of the information or recommendations in this conversation might be out of date.
Hello Maria,
you can use the "find" command for this. Dependent of your "find" version you may have the options -cmin or -amin. The difference between "cmin" and "amin" are changed time and accessed time. This depends on your usecase.
As an easy use case for your problem would be a command like this: 'find /var/log/debug/sendMails.log -cmin 120'
The result will be empty if the file /var/log/debug/sendMails.log didn't change up until 120 min ago.
I hope this helps,
Eugen
Sep, 2017 - Permalink