2024-07-08
Daemonizing Applications With Pm2: A Step-By-Step Guide

PM2 daemonize any app

remember to set unbuffered output flag -u before running any python script, otherwise there will be no output in pm2 log


install and setup pm2 as daemon:

1
2
3
4
5
sudo apt install npm
sudo npm config set registry https://registry.npmmirror.com
sudo npm install -g pm2
pm2 startup

run program as daemon:

1
2
3
4
5
6
7
pm2 start -n <process_name> <executable_name> -- <process_arguments>
# save all processes
pm2 save
pm2 monit
pm2 logs
pm2 ls

Read More

2024-05-12
Viewing Cpu Usage History With Sysstat And The Sar Command

View history CPU usage statistics

First install sysstat package, then run sar -u

Read More