Syncing internal lockfile functions.
This commit is contained in:
parent
425f88e9ec
commit
db5d2b0dcd
|
@ -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}"
|
||||
|
|
Loading…
Reference in New Issue