const fs = require('fs'); var date = new Date(); // var dat= date.getDate()+"-"+(date.getMonth()+1)+"-"+date.getFullYear(); var dat= `${date.getFullYear()}-${(date.getMonth()+1)}-${date.getDate()}`; var err_log = "./pm2/logs/err.log"; var out_log = "./pm2/logs/out.log"; fs.mkdirSync(`./pm2/logs/${dat}`, { recursive: true }); err_log = './pm2/logs/' + dat + '/error.log'; out_log = './pm2/logs/' + dat + '/output.log'; combined_log = './pm2/logs/' + dat + '/combined.log'; // fs.accessSync("./pm2/logs/${dat}",(err) => { // if (!err) { // console.log('in'); // err_log = './pm2/logs/' + date.toISOString() + '/error.log'; // out_log = './pm2/logs/' + date.toISOString() + '/output.log'; // combined_log = './pm2/logs/' + date.toISOString() + '/combined.log'; // } else { // console.error(err)}; // console.log("created succesfully"); // }); module.exports = { apps : [{ name: 'actions', script: 'index.js', max_memory_restart: "500M", merge_logs: true, max_restarts: 20, error_file : err_log, out_file : out_log, // instances: 1, watch: '.' }], };