1. Install pm2-logrotate from online computer with command
pm2 install pm2-logrotate
2. Compress file pm2-logrotate from pm2 module path
cd /root/.pm2/modules/ tar czvf pm2-logrotate.tgz pm2-logrotate/
3. Copy pm2-logrotate to offline computer
4. Decompress file to pm2 module path
cd /root/.pm2/modules/ tar xzvf pm2-logrotate.tgz
5. Start pm2 with command
pm2 start --name "pm2-logrotate" /root/.pm2/modules/pm2-logrotate/node_modules/pm2-logrotate/app.js pm2 save
If you want to change schedule, you can configure from file
vim /root/.pm2/modules/pm2-logrotate/node_modules/pm2-logrotate/package.json
"config": { "max_size": "10M", "retain": "90", "compress": false, "dateFormat": "YYYY-MM-DD_HH-mm-ss", "workerInterval": "30", "rotateInterval": "0 0 * * *", "rotateModule": true },