-
Notifications
You must be signed in to change notification settings - Fork 854
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to auto start service #511
Comments
Background tasks are currently not supported on WSL. One way to accomplish this right now would be to use the "bash.exe -c " to start whatever you want. If you want that to auto start post Windows boot, you can hook that command to the Windows startup. |
Thanks @sunilmut. I'd also like to add that any daemons that you run will be terminated when the last bash.exe goes away so you'll have to leave one bash.exe running. |
Correct me if i'm wrong just running -c with a command will not be enough, you need to exec bash at the end to get the window to stay open. You can either do this: |
Is there any more elegant way in the meantime that is more similar to systemd/upstart? |
It is 2017 now, we still have this problem. the background service is the last thing stopping me to swith from cygwin to wsl. Has it been planned in the feature release ? Any roadmaps ?? |
This question is not answered here. Any progress on this? |
Hi guys, I made a script to support starting the WSL services on Windows start. |
@benhillis's remark is no longer true. |
Yeah that was 2+ years ago. We have added support for background tasks in the meantime. |
@benhillis really? now I run WSL Ubuntu 18.04.1
and the services, some with
|
@benhillis We can start the cron service manually, and it will run as long as the terminal is open, but when we reboot Windows it doesn't start automatically, nor after opening a Bash window. |
Now my solution is adding such like command to ~/.bashrc, |
Here's a minor improvement: in bash.exe -c 'bash /path/to/file.sh; exec bash -i' The final |
In this case, for every instance you'll have extra line of command that potentially cause a delay (might not quite noticeable but definitely not elegant) for example when opening a new tab. |
Any better way to do this in 2021? Thank you in advance and regards |
Hi,
it seems that Ubuntu used upstart and now uses systemd for service management.
I installed mpd and want this service to auto-start. Installation seem to created valid auto start service script as
/lib/systemd/system/mpd.service
but service does not start unless I manually start withsudo service mpd start
.So I wanted to ask how to auto start service generally in WSL?
The text was updated successfully, but these errors were encountered: