Shlock exits with a zero status if it was able to create the lock file, or non-zero if the file refers to currently-active process.
LOCK=<pathrun in inn.conf>/LOCK.send trap 'rm -f ${LOCK} ; exit 1' 1 2 3 15 if shlock -p $$ -f ${LOCK} ; then # Do appropriate work else echo Locked by `cat ${LOCK}` fi