mirror of
https://github.com/crystelf/crystelf-core.git
synced 2025-07-04 06:39:18 +00:00
修复restart临时文件在Linux上的路径问题
This commit is contained in:
parent
683df58d12
commit
33a0cdf946
@ -74,7 +74,8 @@ const apps = {
|
||||
//logger.info(duration);
|
||||
if (duration) {
|
||||
logger.warn(`重启完成!耗时 ${duration} 秒..`);
|
||||
fs.writeFileSync('/temp/restart_time', duration.toString());
|
||||
const restartTimePath = path.join(paths.get('temp'), 'restart_time');
|
||||
fs.writeFileSync(restartTimePath, duration.toString());
|
||||
}
|
||||
|
||||
logger.info('晶灵核心初始化完毕!');
|
||||
|
@ -3,6 +3,7 @@ import logger from './utils/core/logger';
|
||||
import config from './utils/core/config';
|
||||
import redis from './services/redis/redis';
|
||||
import autoUpdater from './utils/core/autoUpdater';
|
||||
import System from './utils/core/system';
|
||||
|
||||
config.check(['PORT', 'DEBUG', 'RD_PORT', 'RD_ADD', 'WS_SECRET', 'WS_PORT']);
|
||||
const PORT = config.get('PORT') || 3000;
|
||||
@ -15,7 +16,8 @@ apps
|
||||
});
|
||||
const isUpdated = await autoUpdater.checkForUpdates();
|
||||
if (isUpdated) {
|
||||
logger.warn(`检测到更新,请重启..`);
|
||||
logger.warn(`检测到更新,正在重启..`);
|
||||
await System.restart();
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
|
@ -1,8 +1,8 @@
|
||||
import WebSocket from 'ws';
|
||||
import axios from 'axios';
|
||||
|
||||
const WS_URL = 'ws://127.0.0.1:4001';
|
||||
const WS_SECRET = '114514';
|
||||
const WS_URL = 'ws://server.crystelf.top:4001';
|
||||
const WS_SECRET = '520520';
|
||||
const CLIENT_ID = 'test';
|
||||
|
||||
function createWebSocketClient() {
|
||||
@ -48,8 +48,8 @@ async function testGetAPI() {
|
||||
|
||||
async function testPostAPI() {
|
||||
try {
|
||||
const response = await axios.post('http://localhost:4000/api/system/getRestartTime', {
|
||||
token: 54188,
|
||||
const response = await axios.post('https://core.crystelf.top/api/system/restart', {
|
||||
token: 114113,
|
||||
});
|
||||
console.log('[HTTP][POST] Response:', response.data);
|
||||
} catch (err) {
|
||||
@ -61,7 +61,6 @@ async function main() {
|
||||
createWebSocketClient();
|
||||
|
||||
setTimeout(() => {
|
||||
testGetAPI();
|
||||
testPostAPI();
|
||||
}, 1000);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user