troytse / wsl-autostart Goto Github PK
View Code? Open in Web Editor NEWSupport for starting the Linux services in Windows Subsystem for Linux (WSL) on Windows startup
License: MIT License
Support for starting the Linux services in Windows Subsystem for Linux (WSL) on Windows startup
License: MIT License
does this commands.txt support systemd?
eg:
my systemd service is pm2-user.service
to start custom service:
sudo systemctl start pm2-user.service
the systemd conf file path:
/etc/systemd/system/pm2-user.service
content:
[Unit]
Description=PM2 process manager
Documentation=https://pm2.keymetrics.io/
After=network.target
[Service]
Type=forking
User=user
LimitNOFILE=infinity
LimitNPROC=infinity
LimitCORE=infinity
Environment=PATH=/usr/local/go/bin:/usr/bin:/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin
Environment=PM2_HOME=/home/user/.pm2
PIDFile=/home/user/.pm2/pm2.pid
Restart=on-failure
ExecStart=/usr/lib/node_modules/pm2/bin/pm2 resurrect
ExecReload=/usr/lib/node_modules/pm2/bin/pm2 reload all
ExecStop=/usr/lib/node_modules/pm2/bin/pm2 kill
[Install]
WantedBy=multi-user.target
how to set the commands.txt file for this?
Is there a way to make it run after windows startup?
The README.md suggests an installation that modify the windows registry. Instead of that option, it is possible to configure Windows 10 to run a program when the computer starts using a startup policy or a scheduled task using administrative tools.
gpedit.msc
, it is possible to define a program that run when the computer starts
SYSTEM
user.taskschd.msc
, it is possible to schedule a task after the startup of the computer.
taskschd.msc
program will show a specific log regarding the execution of the taskIn addition, note that the scheduled task can be created programmatically using Powershell. An user may run a .ps1
script to installs the wsl-autostart
as a scheduled task very easily.
UAC prompt at boot anyway to avoid this?
The wsl command lets you specify what "Linux" user will be used to run a command. Rather then setting up sudo, why not just use "wsl -u root" in your control.bat file?
change control.bat to:
%~d0
cd "%~p0"
for /f %%i in (commands.txt) do (wsl sudo %%i %*)
so that it works when installed under a path that constains spaces
I've added ubuntu2004.exe to Scheduler (after user login).
It starts fine. But I have a UAC popup:
Do you want to allow this app to make changes to your device?
C:\work\wsl-autostart\control.bat
How to fix this? I've seen a similar thread. But I think it addresses not control.bat but something else.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.