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.

pm2 startup | grep "sudo" | bash

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.

crontab -e
# choose a text editor (i.e. nano)

Add the line: @reboot pm2 resurrect, at the end. Then save the file and exit.