Last active
June 11, 2021 10:32
-
-
Save topalex/8f5d8dc5452a4d3f5bb2cbfef20ec376 to your computer and use it in GitHub Desktop.
Auto-start services in WSL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Windows Registry Editor Version 5.00 | |
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run] | |
"WSLAutostart"="C:\\wsl-start.bat" | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
set services="/etc/init.d/redis-server","/etc/init.d/nginx" | |
wsl echo OK >nul 2>nul | |
if %errorlevel% == 0 (for %%i in (%services%) do (wsl sudo %%~i start)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment