fix: 脚本路径
This commit is contained in:
@@ -262,6 +262,8 @@ journalctl -u xmonitor-sender.service -f
|
|||||||
ls /home/ubuntu/xMonitor/logs
|
ls /home/ubuntu/xMonitor/logs
|
||||||
```
|
```
|
||||||
|
|
||||||
|
When run manually, the script now auto-loads `/etc/xmonitor/xmonitor.env` if that file exists.
|
||||||
|
|
||||||
### Behavior
|
### Behavior
|
||||||
|
|
||||||
- Hotspot connect retry: every 5 seconds until the target SSID is connected
|
- Hotspot connect retry: every 5 seconds until the target SSID is connected
|
||||||
|
|||||||
@@ -27,6 +27,12 @@ trap 'report_err "${LINENO}" "${BASH_COMMAND}"' ERR
|
|||||||
|
|
||||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
DEFAULT_APP_DIR="$(cd "${SCRIPT_DIR}/.." && 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)}"
|
RUN_USER="${RUN_USER:-$(id -un)}"
|
||||||
APP_DIR="${APP_DIR:-${DEFAULT_APP_DIR}}"
|
APP_DIR="${APP_DIR:-${DEFAULT_APP_DIR}}"
|
||||||
@@ -173,9 +179,14 @@ wait_for_server() {
|
|||||||
log "Starting xMonitor sender bootstrap"
|
log "Starting xMonitor sender bootstrap"
|
||||||
log "Using APP_DIR='${APP_DIR}'"
|
log "Using APP_DIR='${APP_DIR}'"
|
||||||
log "Log file: ${LOG_FILE}"
|
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
|
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}"
|
[[ -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 "${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}"
|
[[ -f "${ROS_SETUP}" ]] || fail "ROS setup file not found: ${ROS_SETUP}"
|
||||||
|
|||||||
Reference in New Issue
Block a user