fix: 脚本路径
This commit is contained in:
@@ -27,6 +27,12 @@ trap 'report_err "${LINENO}" "${BASH_COMMAND}"' ERR
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
DEFAULT_APP_DIR="$(cd "${SCRIPT_DIR}/.." && pwd)"
|
||||
ENV_FILE="${ENV_FILE:-/etc/xmonitor/xmonitor.env}"
|
||||
|
||||
if [[ -f "${ENV_FILE}" ]]; then
|
||||
# shellcheck disable=SC1090
|
||||
source "${ENV_FILE}"
|
||||
fi
|
||||
|
||||
RUN_USER="${RUN_USER:-$(id -un)}"
|
||||
APP_DIR="${APP_DIR:-${DEFAULT_APP_DIR}}"
|
||||
@@ -173,9 +179,14 @@ wait_for_server() {
|
||||
log "Starting xMonitor sender bootstrap"
|
||||
log "Using APP_DIR='${APP_DIR}'"
|
||||
log "Log file: ${LOG_FILE}"
|
||||
if [[ -f "${ENV_FILE}" ]]; then
|
||||
log "Loaded environment from '${ENV_FILE}'"
|
||||
else
|
||||
log "Environment file '${ENV_FILE}' not found; using current shell environment/defaults"
|
||||
fi
|
||||
prune_old_logs
|
||||
|
||||
[[ -n "${HOTSPOT_SSID}" ]] || fail "HOTSPOT_SSID must be set in /etc/xmonitor/xmonitor.env"
|
||||
[[ -n "${HOTSPOT_SSID}" ]] || fail "HOTSPOT_SSID must be set in '${ENV_FILE}' or exported before launching the script"
|
||||
[[ -d "${APP_DIR}" ]] || fail "APP_DIR does not exist: ${APP_DIR}"
|
||||
[[ -f "${APP_DIR}/monitor_sender.py" ]] || fail "monitor_sender.py not found in ${APP_DIR}"
|
||||
[[ -f "${ROS_SETUP}" ]] || fail "ROS setup file not found: ${ROS_SETUP}"
|
||||
|
||||
Reference in New Issue
Block a user