Dev #26

Open
overseer wants to merge 65 commits from dev into main
Showing only changes of commit 9fc80a27c9 - Show all commits
+9 -4
View File
@@ -72,8 +72,12 @@ fi
# 2. Deploy new binary # 2. Deploy new binary
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
info "Deploying new binary..." info "Deploying new binary..."
cp "${BINARY}" "${DEPLOY_PATH}" # Atomic replace: copy alongside then rename over the target. A plain
chmod +x "${DEPLOY_PATH}" # cp over a running executable fails with "Text file busy"; rename swaps
# the directory entry and works while the old binary is still running.
cp "${BINARY}" "${DEPLOY_PATH}.new"
chmod +x "${DEPLOY_PATH}.new"
mv -f "${DEPLOY_PATH}.new" "${DEPLOY_PATH}"
ok "Binary installed at ${DEPLOY_PATH}" ok "Binary installed at ${DEPLOY_PATH}"
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
@@ -116,8 +120,9 @@ else
# ----------------------------------------------------------------------- # -----------------------------------------------------------------------
if [ -f "${BACKUP}" ]; then if [ -f "${BACKUP}" ]; then
info "Restoring backup: ${BACKUP}" info "Restoring backup: ${BACKUP}"
cp "${BACKUP}" "${DEPLOY_PATH}" cp "${BACKUP}" "${DEPLOY_PATH}.new"
chmod +x "${DEPLOY_PATH}" chmod +x "${DEPLOY_PATH}.new"
mv -f "${DEPLOY_PATH}.new" "${DEPLOY_PATH}"
systemctl restart "${SERVICE}" 2>/dev/null || true systemctl restart "${SERVICE}" 2>/dev/null || true