3 # Copyright (C) 2008-2009 Equinox Software, Inc.
\r
4 # Written by Dave Brown <dbrown@esilibrary.com>
\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
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
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
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
32 echo "CRIT: $filetocheck exists but $proctocheck not running"
\r
36 echo "OK: $filetocheck not found"
\r