From 17c2064036a014d746dba83e903a793bdc81504a Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Wed, 25 Jun 2025 08:59:27 +0200 Subject: [PATCH] Update create_lxc.sh --- misc/create_lxc.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/misc/create_lxc.sh b/misc/create_lxc.sh index 67e5ffe2..e3fbe987 100644 --- a/misc/create_lxc.sh +++ b/misc/create_lxc.sh @@ -24,10 +24,11 @@ trap 'error_handler $LINENO "$BASH_COMMAND"' ERR trap on_exit EXIT trap on_interrupt INT trap on_terminate TERM +LOCKFD=9 function on_exit() { local exit_code="$?" - [[ -n "${lockfile:-}" ]] && exec "$LOCKFD" >&- # Lockfile schließen + [[ -n "${lockfile:-}" ]] && exec "$LOCKFD" >&- # close Lockfile exit "$exit_code" } @@ -245,8 +246,8 @@ PCT_OPTIONS=(${PCT_OPTIONS[@]:-${DEFAULT_PCT_OPTIONS[@]}}) # Secure creation of the LXC container with lock and template check lockfile="/tmp/template.${TEMPLATE}.lock" -exec 9>"$lockfile" -flock -w 60 9 || { +exec $LOCKFD >"$lockfile" +flock -w 60 $LOCKFD || { msg_error "Timeout while waiting for template lock" exit 211 }