#!/usr/bin/env bash set -euo pipefail ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" # shellcheck disable=SC1091 source "${ROOT}/lib/common.sh" SRC_ARG="${1:-1}" PID_ENCODE="${RUN_DIR}/encode.pid" LOG_RUN="${STORAGE_DIR}/run-encode-only.log" ensure_storage mkdir -p "${RUN_DIR}" if [[ -f "${PID_ENCODE}" ]] && kill -0 "$(cat "${PID_ENCODE}")" 2>/dev/null; then die "encode-only already running (pid $(cat "${PID_ENCODE}")). use bin/stop.sh first" fi chmod +x "${ROOT}/bin/"*.sh 2>/dev/null || true log "starting encode-only source=${SRC_ARG}" nohup "${ROOT}/bin/encode-only.sh" "${SRC_ARG}" >> "${LOG_RUN}" 2>&1 & echo $! > "${PID_ENCODE}" log "encode pid $(cat "${PID_ENCODE}")"