var pm2 = require('pm2'); var path = require('path'); pm2.start({ name: "PostgresSql", script: "/postgres/bin/postgres.exe", args: "-D /postgres/data/pgsql/", exec_mode: "fork_mode", max_memory_restart: '2G', autorestart: true, output: "out.log", error: "error.log" }, function (err, apps) { if (err != null) console.log(error); pm2.disconnect(); });