# Run elasticsearch on startup

**URL:** <https://discuss.elastic.co/t/run-elasticsearch-on-startup/307036>\
**Category:** Elasticsearch\
**Created:** [June 13, 2022, 1:18pm UTC](https://discuss.elastic.co/t/run-elasticsearch-on-startup/307036 "2022-06-13T13:18:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Franck\_LONGO](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/franck_longo/32/86117_2.png) [@Franck\_LONGO](https://discuss.elastic.co/u/Franck_LONGO)\
**Post date:** [June 13, 2022, 1:18pm UTC](https://discuss.elastic.co/t/run-elasticsearch-on-startup/307036/1 "2022-06-13T13:18:07Z")

</div>

Hi there,

I installed **Nextcloud** on **Windows with WSL 2** and **Elasticsearch.** All is working great but I’m unable to run Elasticsearch on Windows Startup.

I managed to have **MYSQL, APACHE2 and CRON** running on startup with this solution:

```auto
* adding **%sudo ALL=NOPASSWD: /etc/init.d/mysql start** with sudo visudo
* adding **%sudo ALL=NOPASSWD: /etc/init.d/apache2 start** with sudo visudo
* adding **%sudo ALL=NOPASSWD: /etc/init.d/cron start** with sudo visudo
* Create a shortcut in **shell:startup** with arguments: “C:\Program Files\WindowsApps\CanonicalGroupLimited.Ubuntu20.04LTS_2004.4.5.0_x64__79rhkp1fndgsc\ubuntu2004.exe” run sudo /etc/init.d/mysql start
* Create a shortcut in **shell:startup** with arguments: “C:\Program Files\WindowsApps\CanonicalGroupLimited.Ubuntu20.04LTS_2004.4.5.0_x64__79rhkp1fndgsc\ubuntu2004.exe” run sudo /etc/init.d/apache2 start
* Create a shortcut in **shell:startup** with arguments: “C:\Program Files\WindowsApps\CanonicalGroupLimited.Ubuntu20.04LTS_2004.4.5.0_x64__79rhkp1fndgsc\ubuntu2004.exe” run sudo /etc/init.d/cron start

```

So, logically I tried to do the same for **Elasticsearch** but the service doesn’t start.

That’s strange because I can start the service when I launch the WSL 2 CLI and type: “sudo service Elasticsearch start”

Any idea?

Thanks in advance.  
Franck

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 11, 2022, 1:18pm UTC](https://discuss.elastic.co/t/run-elasticsearch-on-startup/307036/2 "2022-07-11T13:18:50Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
