Fix memory leak in check_http for large pages (Jimmy Bergman - #2957455)
[monitoring-plugins.git] / contrib / check_joy.sh
blob8783a59fca1af9abf6203f5f88389cf7221aa155
1 #! /bin/sh
3 PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
5 PROGNAME=`basename $0`
6 PROGPATH=`echo $0 | sed -e 's,[\\/][^\\/][^\\/]*$,,'`
7 REVISION=`echo '$Revision: 2 $' | sed -e 's/[^0-9.]//g'`
8 STATUS=""
10 . $PROGPATH/utils.sh
13 print_usage() {
14 echo "Usage: $PROGNAME /dev/js<#> <button #>"
17 print_help() {
18 print_revision $PROGNAME $REVISION
19 echo ""
20 print_usage
21 echo ""
22 echo "This plugin checks a joystick button status using the "
23 echo "joyreadbutton utility from the joyd package."
24 echo ""
25 support
26 exit 0
29 if [ $# -ne 2 ]; then
30 print_usage
31 exit 0
34 case "$1" in
35 --help)
36 print_help
37 exit 0
39 -h)
40 print_help
41 exit 0
43 --version)
44 print_revision $PROGNAME $REVISION
45 exit 0
47 -V)
48 print_revision $PROGNAME $REVISION
49 exit 0
51 /dev/js*)
52 joyreadbutton $1 $2 1>&1 1>/dev/null
53 STATUS=$?
54 if [ "$STATUS" -eq 0 ]; then
55 echo OK
56 exit 0
57 elif [ "$STATUS" -eq 1 ];then
58 echo CRITICAL
59 exit 2
60 else
61 echo UNKNOWN
62 exit -1
66 print_usage
67 exit 0
69 esac