Syncing internal lockfile functions.

This commit is contained in:
Daniel Baumann 2008-11-01 14:40:21 +01:00
parent 425f88e9ec
commit db5d2b0dcd
1 changed files with 13 additions and 2 deletions

View File

@ -11,10 +11,15 @@ Check_lockfile ()
{ {
FILE="${1}" FILE="${1}"
if [ -z "${FILE}" ]
then
FILE="/var/lock/${PROGRAM}.lock"
fi
# Checking lock file # Checking lock file
if [ -f "${FILE}" ] if [ -f "${FILE}" ]
then then
Echo_error "system locked" Echo_error "${PROGRAM} locked"
exit 1 exit 1
fi fi
} }
@ -22,7 +27,13 @@ Check_lockfile ()
Create_lockfile () Create_lockfile ()
{ {
FILE="${1}" FILE="${1}"
DIRECTORY="$(dirname ${1})"
if [ -z "${FILE}" ]
then
FILE="/var/lock/${PROGRAM}.lock"
fi
DIRECTORY="$(dirname ${FILE})"
# Creating lock directory # Creating lock directory
mkdir -p "${DIRECTORY}" mkdir -p "${DIRECTORY}"