Skip to content

Instantly share code, notes, and snippets.

@Senpai-Codes
Created August 5, 2021 14:53
Show Gist options
  • Select an option

  • Save Senpai-Codes/c12c3939af9feace7147d23e24736fde to your computer and use it in GitHub Desktop.

Select an option

Save Senpai-Codes/c12c3939af9feace7147d23e24736fde to your computer and use it in GitHub Desktop.
WSL Run Script on Startup
#answer from https://superuser.com/questions/1343558/how-to-make-wsl-run-services-at-startup
Step-1: Create line in /etc/sudoers (at WSL to prevent asking password):
%sudo ALL=(ALL) NOPASSWD: /usr/sbin/service mysql start
Step-2: Create .bat file in Windows startup directory with this line (dir find here: Win+R and shell:startup):
wsl sudo service apache2 start
wsl sudo service mysql start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment