$ | >

Run services when Windows starts?

In Bash, I can set services to boot on startup with something like this:

sudo systemctl enable application.service

However, it would be really handy if certain Bash services started when Windows started. (especially for web servers, database engines etc.)

I know the way Windows and Linux does services is quite different but as an example, it would be great if I could start Windows and know that my local MongoDB server is all fired up and ready to go.

Would love to know other peoples thoughts on this and if it's at all feasible?

Thanks, Anthony
Twitter: @anthonycook

291 votes
Sign in
Sign in with: facebook google
Signed in as (Sign out)

We’ll send you updates on this idea

Anthony shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →


Sign in
Sign in with: facebook google
Signed in as (Sign out)
  • Kenneth Benson commented  ·   ·  Flag as inappropriate

    Please see the ask "Consider enabling cron jobs, daemons and background tasks". A team response said it was in the upcoming release.

  • WSLUser commented  ·   ·  Flag as inappropriate

    There's already a uservoice for background tasks and this is has been fulfilled within Insider builds.

  • WinEunuuchs2Unix commented  ·   ·  Flag as inappropriate

    There is [wabasj](https://github.com/cerebrate/wabash/blob/master/README.md):

    "So, you want to keep daemons or disowned processes running under Windows Services for Linux even without a bash console open? Well, look no further, friends and users, because wabash is here to help, a simple utility which keeps the WSL session going in the background all the time. It is also capable (0.5.2 and later) of automatically starting any system services/daemons capable of being started by service(8)."

  • ALGN2 commented  ·   ·  Flag as inappropriate

    Using task scheduler, I created a startup script that runs bash.exe as follows:

    C:\Windows\System32\bash.exe -b /home/MYUSERNAME/wslutil/start_svcs

    Where start_svcs is a su-enabled (via sudoers) script that launches openssh after
    logging in to Windows. As long as I'm logged in, I can ssh into WSL from anywhere.
    One thing that I can't do is to start WSL when windows boots. It's at this point that I realized
    that WSL is a hobbled Linux, because it's implemented on top of Windows. It's just a shade
    better than Cygwin, because WSL is implemented at a lower level.

  • Anonymous commented  ·   ·  Flag as inappropriate

    You could try running bash.exe as a service with nssm.exe. I tried, it seems it works.

  • Carlos Gonzales commented  ·   ·  Flag as inappropriate

    My laptop is used primarily for development and I prefer running certain services in ubuntu. I would appreciate this capability.

Feedback and Knowledge Base