-
Notifications
You must be signed in to change notification settings - Fork 0
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
Service doesn't automatically start when Windows boots up #25
Comments
Based on what I've found so far, I believe that a combination of using a scheduled task with VBS script to start the instance, an entry in the wsl.conf to start the service and then a shell script to run the docker-compose command and possibly another command such as keychain, may be the way to go. This is more complicated than on a traditional system simply because Windows is configured to terminate the WSL environment if there are no interactive processes running. So, the shell script is critical to keep the environment online. Some resources I've found so far: |
I will add this information to the documentation as well. But here is the portion of the solution on the WSL side that appears to be working thus far. Step 3 still needs to be completed and tested, but I'm including it here for completeness. Step 1 - Add boot command to wsl.confAs root, create /etc/wsl.conf if necessary, then edit the file and add the following:
Step 2 - Create shell script
In the text editor add the following lines to the launch_minermonitor.sh script
Step 3 - Create the VBS script and scheduled taskFollow the example at https://medium.com/swlh/how-to-run-ubuntu-in-wsl2-at-startup-on-windows-10-c4567d6c48f1 |
Couldn't get the vbScript example to work, so I decided to try powershell however that's not working either. A little more digging and I found there is an issue microsoft/WSL#8835. Several people mentioned different workarounds (psexec, non-store version, etc.) I will have to explore some of these to see if they will work (as success is reported as hit or miss with each workaround) |
Using a combination of vbscript, powershell and PsExec I was able to get the scheduled task for starting WSL2 to work. Scripts have been saved in the utils/automatic_startup_files folder of this repo. This solution is inspired by cheng-chi's repo here. Updated step 3 instructions: Step 3 - Setting up the Scheduled Task
|
I'm currently running this application in WSL2 on Windows 11 with Docker installed in WSL2. The problem is that if the computer reboots, the service is down until I log on, open a WSL terminal, start the docker service and then run the docker-compose up -d command to start the containers.
Ideally, the WSL environment would automatically launch and start the docker service and then run the docker-compose command without any manual intervention so that the least amount of data is missed in the logs.
The text was updated successfully, but these errors were encountered: