Search code examples
node.jspm2

How not to create a "cron-out" log file?


When I run pm2, it creates two cron-out and cron-error files in the logs folder. How to not create these files when starting pm2?


Solution

  • You can Generate Configuration

    pm2 ecosystem
    

    This will generate following file (ecosystem.config.js) ,pass error_file: "/dev/null" to not to generate pm2 logs

    module.exports = {
      apps : [{
        name: "app",
        script: "./app.js",
        error_file: "/dev/null"  
        env: {
          NODE_ENV: "development",
        },
        env_production: {
          NODE_ENV: "production",
        }
      }]
    }
    
    pm2 [start|restart|stop|delete] ecosystem.config.js
    

    This is the link I followed -http://pm2.keymetrics.io/docs/usage/application-declaration/

    Or Shortest Way

    pm2 start app /dev/null