| 1234567891011121314151617181920 | #!/bin/bash# Log check scheduleLOGSCHEDULE=${LOGSCHEDULE:-1800}# Log difference in seconds_LOGDIFF=600# Log path_LOGDIR="/opt/analis/log"# Discover latest modified file_LOGFILE=${_LOGDIR}AnalisatorService_$(date +%d-%m-%Y)#Check is it time to run _LOGFILE checkif [[  $[ $(date +%s) - $(stat -c %Y "/opt/analis/checkfile.status") ] -gt ${LOGSCHEDULE} ]]; then     touch /opt/analis/checkfile.status    #Check difference between system time and latest modified file in logdir - if it's greater then $_LOGDIFF, then container is not healty    if [[  $[ $(date +%s) - $(stat -c %Y "${_LOGFILE}") ] -gt ${_LOGDIFF} ]]; then        echo -e $(date)" The difference between system time and latest modified file in logdir is "$[ $(date +%s) - $(stat -c %Y ${_LOGFILE}) ]" The service seems to be unhealty.\n\r" >> ${_LOGDIR}/healthcheck.log        exit 1    fifi
 |