Update pm2.config.js

This commit is contained in:
freearhey
2026-02-13 12:50:19 +03:00
parent de08d7df85
commit 0e61dff190

View File

@@ -1,35 +1,35 @@
const grab = process.env.SITE const grab = process.env.SITE
? `npm run grab -- --site=${process.env.SITE} ${process.env.CLANG ? `--lang=${process.env.CLANG}` : '' ? `npm run grab -- --site=${process.env.SITE} ${
} --output=public/guide.xml` process.env.CLANG ? `--lang=${process.env.CLANG}` : ''
: 'npm run grab -- --channels=channels.xml --output=public/guide.xml' } --output=public/guide.xml`
: 'npm run grab -- --channels=public/channels.xml --output=public/guide.xml'
const apps = [ const apps = [
{ {
name: 'serve', name: 'serve',
script: 'npx serve -- public', script: 'npx serve -- public',
instances: 1, instances: 1,
watch: false, watch: false,
autorestart: true autorestart: true
}, },
{ {
name: 'grab', name: 'grab',
script: `npx chronos -e "${grab}" -p "${process.env.CRON_SCHEDULE}" -l`, script: `npx chronos -e "${grab}" -p "${process.env.CRON_SCHEDULE}" -l`,
instances: 1, instances: 1,
watch: false, watch: false,
autorestart: true autorestart: true
} }
]; ]
if (process.env.RUN_AT_STARTUP === 'true') { if (process.env.RUN_AT_STARTUP === 'true') {
apps.push({ apps.push({
name: 'grab-at-startup', name: 'grab-at-startup',
script: grab, script: grab,
instances: 1, instances: 1,
autorestart: false, autorestart: false,
watch: false, watch: false,
max_restarts: 1 max_restarts: 1
}); })
} }
module.exports = { apps }; module.exports = { apps }