diff options
Diffstat (limited to 'functions')
-rwxr-xr-x | functions/lockfile.sh | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/functions/lockfile.sh b/functions/lockfile.sh index 93da69e4d..c4010fb67 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}" |