Check age of file

This simple custom.conf entry will test the age (in hours) of a file and report that back to SysOrb:

[DB dump age rscds]
command=bash -c 'echo $[ ( $(date "+%s") - $(stat -c "%Y" /var/lib/postgres/backups/rscds.sql.tar.gz) ) / 3600 ]'
type=integer
timeout=30
result_pattern=(digit:+)
unit=h

The idea is, that we use 'date' to find out what time it is now, stat to find out the age of the file, and the simple bash arithmetic to compute the difference (in seconds) and to divide with 3600 to get a result in hours instead of seconds.