fix: 自启动

This commit is contained in:
2026-04-14 22:06:16 +08:00
parent d574ba3414
commit b91376663a
8 changed files with 769 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
# Install this file to /etc/systemd/system/xmonitor-sender.service on the target Ubuntu device.
# If you do not use /home/ubuntu/xMonitor, update User, WorkingDirectory, ExecStart, and APP_DIR together.
[Unit]
Description=xMonitor Robot Status Sender
After=NetworkManager.service
Wants=NetworkManager.service
StartLimitIntervalSec=0
[Service]
Type=simple
User=ubuntu
WorkingDirectory=/home/ubuntu/xMonitor
EnvironmentFile=/etc/xmonitor/xmonitor.env
Environment=PYTHONUNBUFFERED=1
ExecStart=/home/ubuntu/xMonitor/scripts/start_monitor_sender.sh
Restart=always
RestartSec=5
TimeoutStartSec=0
StandardOutput=journal
StandardError=journal
SyslogIdentifier=xmonitor-sender
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,19 @@
# Copy this file to /etc/xmonitor/xmonitor.env on the target Ubuntu device.
# Then edit the values and lock down the permissions:
# sudo install -d -m 700 /etc/xmonitor
# sudo cp deploy/xmonitor.env.example /etc/xmonitor/xmonitor.env
# sudo chmod 600 /etc/xmonitor/xmonitor.env
HOTSPOT_SSID=YOUR_PHONE_HOTSPOT
HOTSPOT_PASSWORD=YOUR_HOTSPOT_PASSWORD
SERVER_IP=10.0.0.5
SERVER_PORT=9000
ROS_SETUP=/home/ubuntu/ros2ws/install/setup.bash
APP_DIR=/home/ubuntu/xMonitor
RUN_USER=ubuntu
# Optional overrides.
PYTHON_BIN=python3
WIFI_RETRY_INTERVAL=5
PING_RETRY_INTERVAL=5
LOG_RETENTION_COUNT=20