<p>When configuring PM2 is finished and it's working properly, you must run two commands to make your PM2 as a autostart service and enjoy that.
1) Run 'pm2 save': It's save all of your PM2 configure to a file.</p>

<pre><code>admin@server:~$ sudo pm2 save
</code></pre>

<p>2) Run 'pm2 startup': This command creates a system service and runs your last change saved with the first step. </p>

<pre><code>admin@server:~$ sudo pm2 startup
</code></pre>

<p>So, Run the first command when you changed the configuration to store the last changes.</p>

CC BY-SA 4.0
2019-05-11T05:27:08.513Z
2019-05-11T05:27:08.513Z
Amintabar
<p>I want to make my PM2 as a startup service, because for example when my server loses power or something happens to it, it does not automatically restart the PM2 service.</p>

<linux>
How to make PM2 as a autostart service?
Amintabar
# How to make PM2 as a autostart service?

(Asked by: username_0 on 2019-05-11)

I want to make my PM2 as a startup service, because for example when my server loses power or something happens to it, it does not automatically restart the PM2 service.

**Tags:** linux


---

## 1 answers

### Answer by username_0 on 2019-05-11. Score: 2

When configuring PM2 is finished and it's working properly, you must run two commands to make your PM2 as a autostart service and enjoy that.
1) Run 'pm2 save': It's save all of your PM2 configure to a file.
admin@server:~$ sudo pm2 save

2) Run 'pm2 startup': This command creates a system service and runs your last change saved with the first step. 
admin@server:~$ sudo pm2 startup

So, Run the first command when you changed the configuration to store the last changes.


---

