codea.live
Search…
24/7 Hosting
A guide to keep Rasberry Pi online 24/7.

Start on Startup

With PM2

This will save a PM2 script to boot at startup. This requires root permissions to execute.
1
pm2 startup | grep "sudo" | bash
Copied!

With Crontab

This will add a system wide event to cron, a task scheduling process, to auto resurrect saved PM2 processes. This will apply for all system users.
1
crontab -e
2
# choose a text editor (i.e. nano)
Copied!
Add the line: @reboot pm2 resurrect, at the end. Then save the file and exit.
Last modified 10mo ago
Copy link