From db5d2b0dcdae96e712661605e17bc9875e224f9f Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 1 Nov 2008 14:40:21 +0100 Subject: Syncing internal lockfile functions. --- functions/lockfile.sh | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/functions/lockfile.sh b/functions/lockfile.sh index 93da69e..c4010fb 100755 --- a/functions/lockfile.sh +++ b/functions/lockfile.sh @@ -11,10 +11,15 @@ Check_lockfile () { FILE="${1}" + if [ -z "${FILE}" ] + then + FILE="/var/lock/${PROGRAM}.lock" + fi + # Checking lock file if [ -f "${FILE}" ] then - Echo_error "system locked" + Echo_error "${PROGRAM} locked" exit 1 fi } @@ -22,7 +27,13 @@ Check_lockfile () Create_lockfile () { FILE="${1}" - DIRECTORY="$(dirname ${1})" + + if [ -z "${FILE}" ] + then + FILE="/var/lock/${PROGRAM}.lock" + fi + + DIRECTORY="$(dirname ${FILE})" # Creating lock directory mkdir -p "${DIRECTORY}" -- cgit v1.0