Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > e5dacb39141c2088e2c30e21fa0b2b06 > files > 103

nagios-check_mk-doc-1.2.3i1-3.mga4.noarch.rpm

#!/sbin/sh
CACHE_FILE=/tmp/XXXXX.cache
# Do not use cache file after 20 minutes
MAXAGE=1200
USE_CACHE_FILE=""
# Check if file exists and is recent enough
if [ -s $CACHE_FILE ]
then
    MTIME=$(/usr/bin/perl -e 'if (! -f $ARGV[0]){die "0000000"};$mtime=(stat($ARGV[0]))[9];print ($^T-$mtime);' $CACHE_FILE )
    if (( $MTIME < $MAXAGE )) ; then
        USE_CACHE_FILE=1
    fi
fi
if [ -s "$CACHE_FILE" ]
then
    cat $CACHE_FILE
fi
if [ -z "$USE_CACHE_FILE" -a ! -e "$CACHE_FILE.new" ]
then
    nohup sh -c "XXXXXX" > $CACHE_FILE.new 2> /dev/null && mv $CACHE_FILE.new $CACHE_FILE  &
fi