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