# \[HOW TO\] RocketChat on boot with systemctl

**URL:** <https://forums.rocket.chat/t/how-to-rocketchat-on-boot-with-systemctl/2716>\
**Category:** Community Guides\
**Created:** [December 17, 2018, 9:57am UTC](https://forums.rocket.chat/t/how-to-rocketchat-on-boot-with-systemctl/2716 "2018-12-17T09:57:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![optimistic5](https://avatars.discourse-cdn.com/v4/letter/o/bb73d2/32.png) [@optimistic5](https://forums.rocket.chat/u/optimistic5)\
**Post date:** [December 17, 2018, 9:57am UTC](https://forums.rocket.chat/t/how-to-rocketchat-on-boot-with-systemctl/2716/1 "2018-12-17T09:57:51Z")

</div>

I installed RocketChat with manual instalation on Ubuntu Server.  
It works fine few days and than **RocketChat stopped to boot in autorun**.

During installation I created System init  
`/etc/systemd/system/rocketchat.service`

```
[Unit]
Description=Rocket.Chat server
After=network.target nss-lookup.target mongod.target

[Service]
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=rocketchat
User=rocket
Environment=MONGO_URL=mongodb://localhost:27017/rocketchat ROOT_URL=https://xxxDOMAINxxx PORT=3000
ExecStart=/usr/local/bin/node /opt/rocket/Rocket.Chat/main.js

[Install]
WantedBy=multi-user.target

```

and added to systemctl as a service to boot on autostart

```
sudo systemctl daemon-reload
sudo systemctl start rocketchat
sudo systemctl status rocketchat
sudo systemctl enable rocketchat

```

So, for some reason it worked few days and than something happened and **systemctl did not run rocketchat**.  
System init was active, but did’t start on boot.  
Also it started manually with:  
`sudo systemctl start rocketchat`

**So I danced with systemctl 2 days and finally found out a solution!**  
I added one line to `/etc/systemd/system/rocketchat.service`  
`ExecStartPre=/bin/sleep 20`

And now this System init succesfully boot rocketchat on autostart!

```
[Unit]
Description=Rocket.Chat server
After=network.target nss-lookup.target mongod.target

[Service]
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=rocketchat
User=rocket
Environment=MONGO_URL=mongodb://localhost:27017/rocketchat ROOT_URL=https://xxxDOMAINxxx PORT=3000
ExecStartPre=/bin/sleep 20
ExecStart=/usr/local/bin/node /opt/rocket/Rocket.Chat/main.js

[Install]
WantedBy=multi-user.target
```

---

<div class="post-metadata">

**Author:** ![ripoid](https://avatars.discourse-cdn.com/v4/letter/r/7ba0ec/32.png) [@ripoid](https://forums.rocket.chat/u/ripoid)\
**Post date:** [May 9, 2020, 6:10pm UTC](https://forums.rocket.chat/t/how-to-rocketchat-on-boot-with-systemctl/2716/2 "2020-05-09T18:10:37Z")

</div>

Thank you! This help me a lot!
