You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Windows Bash services are stopped when closing the Bash tab #709
All services from WSL are terminated when I close all instances of Bash
There should be a setting allowing me to run them allways in the background and also at the start of the system. This disables the Reboot (@reboot) ability of cron.
My Windows Build Number: 14393.5
Reacted by Federico, Alex, Navid Rahimi, lawre, Christian Brüggemann, Aokromes, w1sht0l1v3, AStupidBear, Peter Uhnak, Alex Leung and 10 more
The ability to run without having a terminal open is a heavily requested feature for daemons, cron jobs, and other scenarios. Please vote on the User Voice page listed above (thanks rodrymbo).
Dominik Skála (@Skalin) I dunno, because right now the feature that you want isn't directly supported, and for the moment it's your only choice to get the annoying black window off of your screen!
Thanks for pointing out run.exe fpqc. I have not tried it myself and it is good to know that there is a potential work-around for people who want to run without a console window up. You have mentioned it in a few other threads and it looks like a useful tool for many.
I am always amazed at this community and it's ability to work around features we simply haven't had time to implement. It just shows the desire for WSL as a whole. Rest assured we will continue to work on natively supporting many of these features. Until then, workarounds like this may be required for some scenarios.
Please keep the feature requests, and the potential workarounds, piling in.
fpqc run.exe works beautifully. I'm just curious why you would run a copy of bash.exe rather than point it to c:\windows\system32\bash.exe? I find this is working fine.
fpqc -- could you try again?, and check your spam filters? I'm currently hosting that forum, but the hosting provider has been flaky. If it doesn't work, I may migrate elsewhere.
I will update that wording slightly. This support enables processes to run after the last terminal has been closed. There is not yet a direct mechanism for starting processes at boot, etc.
ken@WinDev1612Sys:/mnt/c/Users/there/source$ ps ax
PID TTY STAT TIME COMMAND
1 ? Ss 0:00 /init ro
36 ? S 0:00 dbus-launch --autolaunch=2e97729bd10d45a992b7e6901e82eb13 --binary-syntax --close-stderr
37 ? Ss 0:00 /usr/bin/dbus-daemon --fork --print-pid 5 --print-address 7 --session
45 ? Sl 0:00 /usr/lib/gvfs/gvfsd
57 ? S 0:00 /usr/lib/x86_64-linux-gnu/gconf/gconfd-2
59 ? Sl 0:00 /usr/lib/dconf/dconf-service
24031 tty1 Ss 0:00 /init ro
24032 tty1 S 0:00 -bash
24317 tty1 R 0:00 ps ax
What is the preferred method to shut down daemony things that get launched? In this case they were a side effect of opening a large popular application that helpfully autostarts stuff it needs. I assume killing them manually by PID is the way to go for now.
As a total side note, that gvfsd (of all things in the world) autostarted without any errors or warnings. It can't possibly "work", of course. But it sure made me laugh.
Short answer is you can kill off the WSL instance with wsl --terminate <distro> on 18305 or better.
Longer answer. I suppose it would be possible to put an exit trap in your .bashrc that counts existing bash processes, and then kill off all other detached processes (with sudoers tricks) if that bash instance was the last one standing. Wouldn't recommend it. But doable I guess.
Activity
rodrymbo commentedon Aug 1, 2016
See https://wpdev.uservoice.com/forums/266908-command-prompt-console-bash-on-ubuntu-on-windo/suggestions/13301121-let-bash-continue-running-even-when-the-terminal-h
russalex commentedon Aug 1, 2016
Thanks Dominik Skála (@Skalin)
The ability to run without having a terminal open is a heavily requested feature for daemons, cron jobs, and other scenarios. Please vote on the User Voice page listed above (thanks rodrymbo).
Also note that we are pretty locked down for the Anniversary Update but will be looking at this for future releases.
fpqc commentedon Aug 2, 2016
There is a trick, just run a copy of bash.exe with the third-party run.exe program on startup.
Skalin commentedon Aug 2, 2016
Why the hell would I use thirt-party program to start something implemented in Windows?
fpqc commentedon Aug 2, 2016
Dominik Skála (@Skalin) I dunno, because right now the feature that you want isn't directly supported, and for the moment it's your only choice to get the annoying black window off of your screen!
The feature for windows says it is in beta when you installed it, but it might be better called an alpha, because the feature list isn't frozen.
Run.exe is open-source (GPLv2) and of part of the Xming project and is available (32-bit, 64-bit, and source) at:
http://www.straightrunning.com/XmingNotes/#head-148
the manpage is available here:
http://www.straightrunning.com/projectrun.php
Also, I don't work for Microsoft, and I'm just trying to help you out, so there's no need to be short with me.
russalex commentedon Aug 2, 2016
Thanks for pointing out run.exe fpqc. I have not tried it myself and it is good to know that there is a potential work-around for people who want to run without a console window up. You have mentioned it in a few other threads and it looks like a useful tool for many.
I am always amazed at this community and it's ability to work around features we simply haven't had time to implement. It just shows the desire for WSL as a whole. Rest assured we will continue to work on natively supporting many of these features. Until then, workarounds like this may be required for some scenarios.
Please keep the feature requests, and the potential workarounds, piling in.
xilun commentedon Aug 2, 2016
Russ Alexander (@russalex) Great to hear that you are warming up for the next round of great stuff :)
fpqc maybe you can also open a topic about running in the background on http://wsl-forum.qztc.io/
lawre commentedon Aug 4, 2016
+1 for WSL as a service, sorely needed to get cygwin off the desktop.
lawre commentedon Aug 4, 2016
fpqc run.exe works beautifully. I'm just curious why you would run a copy of bash.exe rather than point it to c:\windows\system32\bash.exe? I find this is working fine.
fpqc commentedon Aug 4, 2016
lawre idk it's already in the Windows PATH, why would I write the full path to bash.exe when it lives in system32?
fpqc commentedon Aug 4, 2016
Guillaume Knispel (@xilun) idk, I made an account on that forum and never got the confirmation email =p
aseering commentedon Aug 4, 2016
fpqc -- could you try again?, and check your spam filters? I'm currently hosting that forum, but the hosting provider has been flaky. If it doesn't work, I may migrate elsewhere.
fpqc commentedon Aug 4, 2016
Adam Seering (@aseering) found it in my e-mail spam folder. Cool registered
*shades*felipemouradev commentedon Jan 27, 2017
Hi everyone, I had problem with cron service, but I solved it with node-cron and forever... Thats works...
heldchen commentedon Nov 22, 2017
from todays 17046 release notes.
wow! how?
Brian-Perkins commentedon Nov 22, 2017
I will update that wording slightly. This support enables processes to run after the last terminal has been closed. There is not yet a direct mechanism for starting processes at boot, etc.
therealkenc commentedon Nov 25, 2017
Nice. But you probably saw this coming.
What is the preferred method to shut down daemony things that get launched? In this case they were a side effect of opening a large popular application that helpfully autostarts stuff it needs. I assume killing them manually by PID is the way to go for now.
As a total side note, that
gvfsd(of all things in the world) autostarted without any errors or warnings. It can't possibly "work", of course. But it sure made me laugh.therealkenc commentedon May 24, 2018
WSL no longer panics when the last console instance is closed. Available in Spring Creators.
ivivanov-bg commentedon Jun 7, 2019
Any way to disable this 'new feature' ?
therealkenc commentedon Jun 7, 2019
Short answer is you can kill off the WSL instance with
wsl --terminate <distro>on 18305 or better.Longer answer. I suppose it would be possible to put an exit trap in your
.bashrcthat counts existingbashprocesses, and then kill off all other detached processes (with sudoers tricks) if thatbashinstance was the last one standing. Wouldn't recommend it. But doable I guess.