-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
CakmLexi
committed
Jun 17, 2024
1 parent
f39dd21
commit 5b1b913
Showing
5 changed files
with
26 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
apps: | ||
- name: "Karin" | ||
# 入口 | ||
script: "./index.js" | ||
script: "./lib/index.js" | ||
# 进程守护 | ||
autorestart: true | ||
# 每分钟最大重启数量 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import fs from 'fs' | ||
import yaml from 'yaml' | ||
import path from 'path' | ||
import { fileURLToPath } from 'url' | ||
import { spawn } from 'child_process' | ||
|
||
const dir = path.resolve(fileURLToPath(import.meta.url), '../../..') | ||
const _path = path.resolve(dir + '/config/config/pm2.yaml') | ||
const data = yaml.parse(fs.readFileSync(_path, 'utf8')) | ||
|
||
const name = data.apps[0].name | ||
const lines = data.lines || 1000 | ||
const cmd = process.platform === 'win32' ? 'pm2.cmd' : 'pm2' | ||
spawn(cmd, ['logs', '--lines', lines, name], { stdio: 'inherit', shell: true, cwd: dir }) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters