Fixed prog_lock so multiple different plugins could run
This commit is contained in:
parent
e013ec9198
commit
744be856b0
1 changed files with 7 additions and 6 deletions
|
@ -373,12 +373,14 @@ check-update() {
|
||||||
}
|
}
|
||||||
|
|
||||||
prog_lock() {
|
prog_lock() {
|
||||||
|
local lock_name=$1
|
||||||
|
|
||||||
## Locking
|
## Locking
|
||||||
|
|
||||||
if [[ "$USER" = "root" ]]; then
|
if [[ "$USER" == "root" ]]; then
|
||||||
LOCKFILE="/var/lock/$(basename "$0")"
|
LOCKFILE="/var/lock/${lock_name}"
|
||||||
else
|
else
|
||||||
LOCKFILE="/tmp/${USER}/lock/$(basename "$0")"
|
LOCKFILE="/tmp/${USER}/lock/${lock_name}"
|
||||||
mkdir -p "/tmp/${USER}/lock"
|
mkdir -p "/tmp/${USER}/lock"
|
||||||
fi
|
fi
|
||||||
LOCKFD=99
|
LOCKFD=99
|
||||||
|
@ -412,14 +414,13 @@ prog_lock() {
|
||||||
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
|
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
|
||||||
# Internal Initialization
|
# Internal Initialization
|
||||||
|
|
||||||
#prog_name=$(basename "$0")
|
prog_name=$(basename "$0")
|
||||||
script_dir=$(dirname "$(readlink -f "$0")")
|
script_dir=$(dirname "$(readlink -f "$0")")
|
||||||
|
|
||||||
prog_lock
|
|
||||||
|
|
||||||
|
|
||||||
# Main
|
# Main
|
||||||
if [[ -r "${script_dir}/plugins/${1}" ]]; then
|
if [[ -r "${script_dir}/plugins/${1}" ]]; then
|
||||||
|
prog_lock "${prog_name}-${1}"
|
||||||
# shellcheck source=plugins/update-ipv4
|
# shellcheck source=plugins/update-ipv4
|
||||||
source "${script_dir}/plugins/${1}"
|
source "${script_dir}/plugins/${1}"
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue