Windows Subsystem for Linux Autoload Apache2 and MySql
![Creative The name of the picture](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgO9GURib1T8z7lCwjOGLQaGtrueEthgQ8LO42ZX8cOfTqDK4jvDDpKkLFwf2J49kYCMNW7d4ABih_XCb_2UXdq5fPJDkoyg7-8g_YfRUot-XnaXkNYycsNp7lA5_TW9td0FFpLQ2APzKcZ/s1600/1.jpg)
![Creative The name of the picture](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYQ0N5W1qAOxLP7t7iOM6O6AzbZnkXUy16s7P_CWfOb5UbTQY_aDsc727chyphenhyphen5W4IppVNernMMQeaUFTB_rFzAd95_CDt-tnwN-nBx6JyUp2duGjPaL5-VgNO41AVsA_vu30EJcipdDG409/s400/Clash+Royale+CLAN+TAG%2523URR8PPP.png)
up vote
0
down vote
favorite
I have activated the Developer Platform in Windows and installed Ubuntu VIA Windows Store which works fabulous! Only thing I need is when I "Activate" Ubuntu Apache2 and MySql does not autostart.
Is there a simple way to make this happen under this Platform? When I open Bash, I can just manually start the Services but Auto Start would be preferred. I have tried using a cron job but the services never started, perhaps my syntax was wrong?
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
@reboot . $HOME/.profile; /usr/sbin/sshd -D
@reboot . $HOME/.profile; service mysql start
@reboot . $HOME/.profile; service apache2 start
16.04 bash apache2 mysql windows-subsystem-for-linux
add a comment |Â
up vote
0
down vote
favorite
I have activated the Developer Platform in Windows and installed Ubuntu VIA Windows Store which works fabulous! Only thing I need is when I "Activate" Ubuntu Apache2 and MySql does not autostart.
Is there a simple way to make this happen under this Platform? When I open Bash, I can just manually start the Services but Auto Start would be preferred. I have tried using a cron job but the services never started, perhaps my syntax was wrong?
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
@reboot . $HOME/.profile; /usr/sbin/sshd -D
@reboot . $HOME/.profile; service mysql start
@reboot . $HOME/.profile; service apache2 start
16.04 bash apache2 mysql windows-subsystem-for-linux
superuser.com/questions/1112007/â¦
â Panther
Mar 31 at 13:20
First step of that process yeilded this....Steve@steve:~$ sudo dpkg-reconfigure openssh-server invoke-rc.d: could not determine current runlevel
â EODCraft Staff
Mar 31 at 13:25
2
You may need to file a bug report with Microsoft. See links in that discussion.
â Panther
Mar 31 at 13:34
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have activated the Developer Platform in Windows and installed Ubuntu VIA Windows Store which works fabulous! Only thing I need is when I "Activate" Ubuntu Apache2 and MySql does not autostart.
Is there a simple way to make this happen under this Platform? When I open Bash, I can just manually start the Services but Auto Start would be preferred. I have tried using a cron job but the services never started, perhaps my syntax was wrong?
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
@reboot . $HOME/.profile; /usr/sbin/sshd -D
@reboot . $HOME/.profile; service mysql start
@reboot . $HOME/.profile; service apache2 start
16.04 bash apache2 mysql windows-subsystem-for-linux
I have activated the Developer Platform in Windows and installed Ubuntu VIA Windows Store which works fabulous! Only thing I need is when I "Activate" Ubuntu Apache2 and MySql does not autostart.
Is there a simple way to make this happen under this Platform? When I open Bash, I can just manually start the Services but Auto Start would be preferred. I have tried using a cron job but the services never started, perhaps my syntax was wrong?
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
@reboot . $HOME/.profile; /usr/sbin/sshd -D
@reboot . $HOME/.profile; service mysql start
@reboot . $HOME/.profile; service apache2 start
16.04 bash apache2 mysql windows-subsystem-for-linux
16.04 bash apache2 mysql windows-subsystem-for-linux
edited Mar 31 at 21:52
asked Mar 31 at 13:15
![](https://i.stack.imgur.com/axbyL.png?s=32&g=1)
![](https://i.stack.imgur.com/axbyL.png?s=32&g=1)
EODCraft Staff
367316
367316
superuser.com/questions/1112007/â¦
â Panther
Mar 31 at 13:20
First step of that process yeilded this....Steve@steve:~$ sudo dpkg-reconfigure openssh-server invoke-rc.d: could not determine current runlevel
â EODCraft Staff
Mar 31 at 13:25
2
You may need to file a bug report with Microsoft. See links in that discussion.
â Panther
Mar 31 at 13:34
add a comment |Â
superuser.com/questions/1112007/â¦
â Panther
Mar 31 at 13:20
First step of that process yeilded this....Steve@steve:~$ sudo dpkg-reconfigure openssh-server invoke-rc.d: could not determine current runlevel
â EODCraft Staff
Mar 31 at 13:25
2
You may need to file a bug report with Microsoft. See links in that discussion.
â Panther
Mar 31 at 13:34
superuser.com/questions/1112007/â¦
â Panther
Mar 31 at 13:20
superuser.com/questions/1112007/â¦
â Panther
Mar 31 at 13:20
First step of that process yeilded this....
Steve@steve:~$ sudo dpkg-reconfigure openssh-server invoke-rc.d: could not determine current runlevel
â EODCraft Staff
Mar 31 at 13:25
First step of that process yeilded this....
Steve@steve:~$ sudo dpkg-reconfigure openssh-server invoke-rc.d: could not determine current runlevel
â EODCraft Staff
Mar 31 at 13:25
2
2
You may need to file a bug report with Microsoft. See links in that discussion.
â Panther
Mar 31 at 13:34
You may need to file a bug report with Microsoft. See links in that discussion.
â Panther
Mar 31 at 13:34
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
2
down vote
Found It!!!!! Although not elegant.
Instead of looping or sleeping just add "bash" to the end of the shell script. Here are my scripts for apache and mysql to run on startup.
VBS file (runs on startup) Win + r shell:startup create autostart.vbs
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run "C:WindowsSystem32bash.exe -c ~/autostart.sh",0
Set WshShell = Nothing
autostart.sh
file (Just make this in your Home Folder, chmod +x runnable
)
#!/bin/bash
sudo service mysql start
sudo service apache2 start
bash
and in /etc/sudoers
(Append to the end of the file)
# Allow apache2 and mysql to start without a sudo password
%sudo ALL=(ALL) NOPASSWD: /usr/sbin/service apache2 *
%sudo ALL=(ALL) NOPASSWD: /usr/sbin/service mysql *
If I need to kill it all I can find the bash process in Task Manager and kill that.
Credit: https://github.com/mstrelan
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
Found It!!!!! Although not elegant.
Instead of looping or sleeping just add "bash" to the end of the shell script. Here are my scripts for apache and mysql to run on startup.
VBS file (runs on startup) Win + r shell:startup create autostart.vbs
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run "C:WindowsSystem32bash.exe -c ~/autostart.sh",0
Set WshShell = Nothing
autostart.sh
file (Just make this in your Home Folder, chmod +x runnable
)
#!/bin/bash
sudo service mysql start
sudo service apache2 start
bash
and in /etc/sudoers
(Append to the end of the file)
# Allow apache2 and mysql to start without a sudo password
%sudo ALL=(ALL) NOPASSWD: /usr/sbin/service apache2 *
%sudo ALL=(ALL) NOPASSWD: /usr/sbin/service mysql *
If I need to kill it all I can find the bash process in Task Manager and kill that.
Credit: https://github.com/mstrelan
add a comment |Â
up vote
2
down vote
Found It!!!!! Although not elegant.
Instead of looping or sleeping just add "bash" to the end of the shell script. Here are my scripts for apache and mysql to run on startup.
VBS file (runs on startup) Win + r shell:startup create autostart.vbs
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run "C:WindowsSystem32bash.exe -c ~/autostart.sh",0
Set WshShell = Nothing
autostart.sh
file (Just make this in your Home Folder, chmod +x runnable
)
#!/bin/bash
sudo service mysql start
sudo service apache2 start
bash
and in /etc/sudoers
(Append to the end of the file)
# Allow apache2 and mysql to start without a sudo password
%sudo ALL=(ALL) NOPASSWD: /usr/sbin/service apache2 *
%sudo ALL=(ALL) NOPASSWD: /usr/sbin/service mysql *
If I need to kill it all I can find the bash process in Task Manager and kill that.
Credit: https://github.com/mstrelan
add a comment |Â
up vote
2
down vote
up vote
2
down vote
Found It!!!!! Although not elegant.
Instead of looping or sleeping just add "bash" to the end of the shell script. Here are my scripts for apache and mysql to run on startup.
VBS file (runs on startup) Win + r shell:startup create autostart.vbs
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run "C:WindowsSystem32bash.exe -c ~/autostart.sh",0
Set WshShell = Nothing
autostart.sh
file (Just make this in your Home Folder, chmod +x runnable
)
#!/bin/bash
sudo service mysql start
sudo service apache2 start
bash
and in /etc/sudoers
(Append to the end of the file)
# Allow apache2 and mysql to start without a sudo password
%sudo ALL=(ALL) NOPASSWD: /usr/sbin/service apache2 *
%sudo ALL=(ALL) NOPASSWD: /usr/sbin/service mysql *
If I need to kill it all I can find the bash process in Task Manager and kill that.
Credit: https://github.com/mstrelan
Found It!!!!! Although not elegant.
Instead of looping or sleeping just add "bash" to the end of the shell script. Here are my scripts for apache and mysql to run on startup.
VBS file (runs on startup) Win + r shell:startup create autostart.vbs
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run "C:WindowsSystem32bash.exe -c ~/autostart.sh",0
Set WshShell = Nothing
autostart.sh
file (Just make this in your Home Folder, chmod +x runnable
)
#!/bin/bash
sudo service mysql start
sudo service apache2 start
bash
and in /etc/sudoers
(Append to the end of the file)
# Allow apache2 and mysql to start without a sudo password
%sudo ALL=(ALL) NOPASSWD: /usr/sbin/service apache2 *
%sudo ALL=(ALL) NOPASSWD: /usr/sbin/service mysql *
If I need to kill it all I can find the bash process in Task Manager and kill that.
Credit: https://github.com/mstrelan
edited Apr 1 at 8:53
![](https://i.stack.imgur.com/Lrlbx.jpg?s=32&g=1)
![](https://i.stack.imgur.com/Lrlbx.jpg?s=32&g=1)
pa4080
12.2k52256
12.2k52256
answered Mar 31 at 21:46
![](https://i.stack.imgur.com/axbyL.png?s=32&g=1)
![](https://i.stack.imgur.com/axbyL.png?s=32&g=1)
EODCraft Staff
367316
367316
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1020837%2fwindows-subsystem-for-linux-autoload-apache2-and-mysql%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
superuser.com/questions/1112007/â¦
â Panther
Mar 31 at 13:20
First step of that process yeilded this....
Steve@steve:~$ sudo dpkg-reconfigure openssh-server invoke-rc.d: could not determine current runlevel
â EODCraft Staff
Mar 31 at 13:25
2
You may need to file a bug report with Microsoft. See links in that discussion.
â Panther
Mar 31 at 13:34