3 ms·
Bingo. The day I can put things in cron in WSL and have them run without needing a window open is the day I stop running a Linux VM.
by Daneel_ 6y ago
Bingo. The day I can put things in cron in WSL and have them run without needing a window open is the day I stop running a Linux VM.
- nobody9999 6y ago>he day I can put things in cron in WSL and have them run without needing a window open is the day I stop running a Linux VM. You could have already been doing that for years[0]. [0] https://cygwin.com https://cygwin.com
- jasomill 6y agoHave you tried installing a cron daemon in WSL using your distro's package manager and starting it with, e.g., wsl -u root /usr/sbin/service <daemon-name> start or, equivalently, wsl -u root /etc/init.d/<daemon-name> start Because I've been starting Debian sshd this way using a Windows Task Scheduler "At startup" task for years, in both WSL 1 and WSL 2, and it "just works". Note that, for my case, WSL 2 requires an additional command to map a TCP port from external adapters to the VM's "host-only" interface, e.g., powershell.exe -NoProfile -NoLogo -Command netsh interface portproxy add v4tov4 listenport=2022 listenaddress=0.0.0.0 connectport=2022 "connectaddress=$( wsl -u root -e perl -e ' print qq{$1} if qx{ip -br addr show eth0} =~ m{ ([0-9.]+)/}')" as a single line, replacing "2022" with the TCP port you want available externally.