Search
j0ke.net Open Build Service
>
Projects
>
server:monitoring
>
nagios-plugins-plesk
> check_stale_lock2
Sign Up
|
Log In
Username
Password
Cancel
Overview
Repositories
Revisions
Requests
Users
Advanced
Attributes
Meta
File check_stale_lock2 of Package nagios-plugins-plesk (Revision 9)
Currently displaying revision
9
,
show latest
#!/bin/bash CNT=0 if [ -z "$@" ] ; then echo "ERROR: no lock files specified" exit 2 fi for ITEM in $@ ; do if [ -z "`echo ${ITEM} | grep :`" ] ; then echo "ERROR: invalid parameter, specify /path/to/lock:<time-in-minutes>" echo "seperate multiple parameters with spaces" exit 2 else LOCK="`echo ${ITEM} | awk -F: '{print $1}'`" MAXLOCKTIME="`echo ${ITEM} | awk -F: '{print $2}'`" LOCKDIR="`dirname ${LOCK}`" LOCKDIR="`readlink -e ${LOCKDIR}`" LOCKNAME="`basename ${LOCK}`" fi for ITEM in `find ${LOCKDIR} -maxdepth 1 -type f -name ${LOCKNAME} -cmin +${MAXLOCKTIME}` ; do CNT=`expr ${CNT} + 1` STALELOCKS="${STALELOCKS} ${LOCKDIR}/`basename ${ITEM}`" done done if [ "${CNT}" -gt 0 ] ; then echo "ERROR: ${STALELOCKS}" exit 2 else echo "OK" exit 0 fi