]> git.evergreen-ils.org Git - contrib/equinox.git/blob - monitoring/nagios/check_lock
errant line sending a copy of the row
[contrib/equinox.git] / monitoring / nagios / check_lock
1 #!/bin/sh\r
2 #\r
3 # Copyright (C) 2008-2009  Equinox Software, Inc.\r
4 # Written by Dave Brown <dbrown@esilibrary.com>\r
5 #\r
6 # This program is free software; you can redistribute it and/or\r
7 # modify it under the terms of the GNU General Public License\r
8 # as published by the Free Software Foundation; either version 2\r
9 # of the License, or (at your option) any later version.\r
10 #\r
11 # This program is distributed in the hope that it will be useful,\r
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of\r
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
14 # GNU General Public License for more details.\r
15 #\r
16 #\r
17 # Author       : Dave Brown, Sys Admin, ESI\r
18 # Last Updated : Sept 5, 2009\r
19 # Purpose      : Check status of file name and process from CL variables.\r
20 # Usage        : check_lock <filename> <process>\r
21 \r
22 \r
23 scriptname=$0\r
24 filetocheck=$1\r
25 proctocheck=$2\r
26 \r
27 if [ -f $filetocheck ]; then\r
28   if [ "$(ps aux | grep -i $proctocheck | grep -v grep | grep -v $scriptname | wc -l)" -gt 0 ]; then\r
29      echo "OK: $filetocheck exists and $proctocheck running"\r
30      exit 0\r
31   else\r
32      echo "CRIT: $filetocheck exists but $proctocheck not running"\r
33      exit 2\r
34   fi\r
35 else\r
36   echo "OK: $filetocheck not found"\r
37   exit 0\r
38 fi\r
39 \r