diff --git a/scripts/actualize-singlechat.sh b/scripts/actualize-singlechat.sh index 90bde9d..2718b9d 100755 --- a/scripts/actualize-singlechat.sh +++ b/scripts/actualize-singlechat.sh @@ -10,7 +10,8 @@ RUN_USER="${RUN_USER:-www-data}" RUN_GROUP="${RUN_GROUP:-www-data}" DEPLOY_USER="${DEPLOY_USER:-${SUDO_USER:-$(id -un)}}" DEPLOY_GROUP="${DEPLOY_GROUP:-$(id -gn "$DEPLOY_USER")}" -LOCK_FILE="${LOCK_FILE:-/tmp/actualize-singlechat.lock}" +LOCK_DIR="${LOCK_DIR:-/tmp/actualize-singlechat}" +LOCK_FILE="${LOCK_FILE:-$LOCK_DIR/deploy.lock}" NPM_CACHE_DIR="${NPM_CACHE_DIR:-$APP_DIR/.npm-cache}" log() { @@ -42,6 +43,10 @@ if [ "$(id -u)" -ne 0 ]; then need_cmd sudo fi +mkdir -p "$LOCK_DIR" +if [ "$(id -u)" -eq 0 ]; then + chown "$DEPLOY_USER:$DEPLOY_GROUP" "$LOCK_DIR" 2>/dev/null || true +fi exec 9>"$LOCK_FILE" if ! flock -n 9; then echo "Deployment laeuft bereits: $LOCK_FILE" >&2