3 # Author : Diego Martin Gardella [dgardella@gmail.com]
4 # Desc : Plugin to verify if a file exists
6 # v1.0: Initial version by Diego Martin Gardella [dgardella@gmail.com]
7 # v1.1: Add negate support, by Elan Ruusamäe <glen@pld-linux.org>
10 PROGPATH=`echo $0 | sed -e 's,[\\/][^\\/][^\\/]*$,,'`
15 echo "Usage: $PROGRAM [-n] [file]
18 -n, --negate negate the result
34 $negate && STATE=$STATE_CRITICAL || STATE=$STATE_OK
35 echo "$(state_name): $1 EXISTS :: `head -3 $1`" # shows the first three lines of the file
39 $negate && STATE=$STATE_OK || STATE=$STATE_CRITICAL
40 echo "$(state_name): $1 Does NOT exist"
43 # parse command line args
44 t=$(getopt -o n --long negate -n "$PROGNAME" -- "$@")
45 [ $? != 0 ] && exit $?
59 echo >&2 "$PROGRAM: Internal error: [$1] not recognized!"
67 if [ "$1" = "" ]; then