支持在Windows启动时启动WSL中的Linux服务.
- 使用 git clone 到任意目录 (e.g
C:\wsl-autostart)
git clone https://github.com/troytse/wsl-autostart- 修改在WSL中
/etc/sudoers文件,为需要自启动的服务指定为免密码. 如:
%sudo ALL=NOPASSWD: /etc/init.d/cron
%sudo ALL=NOPASSWD: /etc/init.d/ssh
%sudo ALL=NOPASSWD: /etc/init.d/mysql
%sudo ALL=NOPASSWD: /etc/init.d/apache2
- 修改
commands.txt文件指定需要自启动的服务. 如:
/etc/init.d/cron
/etc/init.d/ssh
/etc/init.d/mysql
/etc/init.d/apache2

