DEV Community

Discussion on: WSL Tips: Starting Linux Background Services on Windows Login

Collapse
 
peteruhrig profile image
Peter Uhrig

This will not necessarily work when you are runnning multiple WSL distros in parallel. You can resolve this by changing the command line in the task schedulder. In the following example I assume you want to run postgresql in Debian, which is not your primary/default WSL distro:
Instead of 'C:\Windows\System32\bash.exe' write 'wsl'
Instead of '-c "sudo ~./local/bin/start_postgresql.sh"' write '-d debian -e sudo /home/calvin/.local/bin/start_postgresql.sh".
(Yes, I had trouble with the ~ shortcut for the home directory, no idea why.)

Collapse
 
blanxd profile image
Blanxd.H

if the command is sudo, anything after that is already run as root, so the ~ would mean /root and not /home/calvin