After searching this site and various Q, it is clear that services and systemd is not available for WSL. I need to run a program in WSL everytime I start my pc so I read this page on how to use crontab: How to run Ubuntu service on Windows (at startup)? | Super User but I got confused because the format does not tally with the format in crontab. However this is my cron:
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
PATH=cd /usr/local/src/:cd xmr-stak-cpu:cd bin/
@reboot . sudo ./xmr-stak-cpu
I have also done this:
Run bash/cron loop on start
Create a file called linux.bat in shell:startup
Paste: C:\Windows\System32\bash.exe -c 'while [ true ]; do sudo /usr/sbin/cron -f; done'
It does not work.
How can I run a service in WSL? Surely there must be a way that does not require me to be a Linux phd? Or is there a way to use Windows
Because in Windows I have tried the following: using https://github.com/Microsoft/WSL/issues/612
Run: When the computer starts,
Action: Start a program,
Program: c:\Windows\system32\bash.exe,
Arguments: -c "sudo /xmr-stak-cpu/bin/xmr-stak-cpu -D"
Start in: /usr/local/src/
And as you guessed, it still does not work. Frankly I wish I could do this in WSL because it is my preferred way but I will take any way. Please help guys.