Posts

Showing posts with the label auto

WSL Auto-Start and Persistent Background Execution (via SSH)

This guide provides a solution for WSL2 on Windows 10 (also applicable to Windows 11) to enable automatic startup upon boot and maintain continuous background operation. **Key Configuration Steps:** * Install SSH and enable Systemd. * Local Network Connectivity and Firewall Port Forwarding (required for any local network services). * WSL2 Auto-Start / Persistent Background Execution (Win10).   - `sleep infinity`: The core command to keep the instance running. --- **Example Configuration: Please replace these with your own system details** * `<WIN_BAT_PATH>`: The Windows path where your `.bat` files are stored; e.g., `E:\WSL\ubuntu\scripts` * `<WIN_IP>`: Your Windows machine's IP address. ## SSH and Systemd Configuration within WSL Ubuntu ### 1. Install SSH and Enable Systemd * After entering Ubuntu, execute the following commands: ```bash # Update and install sudo apt update && sudo apt install openssh-server -y # Edit wsl.conf to enable systemd (Required for WS...