修改shell根目录获取,移除notify.sh

This commit is contained in:
whyour
2022-03-07 23:16:36 +08:00
parent 1db13653bf
commit 747f4552e0
11 changed files with 86 additions and 59 deletions
+6 -5
View File
@@ -8,6 +8,7 @@ import { AppModel } from '../data/open';
import { AuthModel } from '../data/auth';
import { sequelize } from '../data';
import { fileExist } from '../config/util';
import config from '../config';
export default async () => {
try {
@@ -26,11 +27,11 @@ export default async () => {
// } catch (error) { }
// 2.10-2.11 升级
const cronDbFile = path.join('/ql', 'db/crontab.db');
const envDbFile = path.join('/ql', 'db/env.db');
const appDbFile = path.join('/ql', 'db/app.db');
const authDbFile = path.join('/ql', 'db/auth.db');
const dependenceDbFile = path.join('/ql', 'db/dependence.db');
const cronDbFile = path.join(config.rootPath, 'db/crontab.db');
const envDbFile = path.join(config.rootPath, 'db/env.db');
const appDbFile = path.join(config.rootPath, 'db/app.db');
const authDbFile = path.join(config.rootPath, 'db/auth.db');
const dependenceDbFile = path.join(config.rootPath, 'db/dependence.db');
const crondbExist = await fileExist(cronDbFile);
const dependenceDbExist = await fileExist(dependenceDbFile);
const envDbExist = await fileExist(envDbFile);
+31 -18
View File
@@ -9,6 +9,7 @@ import { DependenceModel } from '../data/dependence';
import { Op } from 'sequelize';
import SystemService from '../services/system';
import ScheduleService from '../services/schedule';
import config from '../config';
export default async () => {
const cronService = Container.get(CronService);
@@ -31,7 +32,9 @@ export default async () => {
const group = groups[key];
const depIds = group.map((x) => x.id);
for (const dep of depIds) {
await dependenceService.reInstall([dep]);
if (dep) {
await dependenceService.reInstall([dep]);
}
}
}
}
@@ -59,10 +62,10 @@ export default async () => {
where: {
command: {
[Op.or]: [
{ [Op.like]: `%\/ql\/scripts\/%` },
{ [Op.like]: `%\/ql\/config\/%` },
{ [Op.like]: `%\/ql\/log\/%` },
{ [Op.like]: `%\/ql\/db\/%` },
{ [Op.like]: `%\/${config.rootPath}\/scripts\/%` },
{ [Op.like]: `%\/${config.rootPath}\/config\/%` },
{ [Op.like]: `%\/${config.rootPath}\/log\/%` },
{ [Op.like]: `%\/${config.rootPath}\/db\/%` },
],
},
},
@@ -70,32 +73,42 @@ export default async () => {
for (let i = 0; i < docs.length; i++) {
const doc = docs[i];
if (doc) {
if (doc.command.includes('/ql/scripts/')) {
if (doc.command.includes(`${config.rootPath}/scripts/`)) {
await CrontabModel.update(
{ command: doc.command.replace('/ql/scripts/', '') },
{ command: doc.command.replace(`${config.rootPath}/scripts/`, '') },
{ where: { id: doc.id } },
);
}
if (doc.command.includes('/ql/log/')) {
await CrontabModel.update(
{ command: `/ql/data/log/${doc.command.replace('/ql/log/', '')}` },
{ where: { id: doc.id } },
);
}
if (doc.command.includes('/ql/config/')) {
if (doc.command.includes(`${config.rootPath}/log/`)) {
await CrontabModel.update(
{
command: `/ql/data/config/${doc.command.replace(
'/ql/config/',
command: `${config.rootPath}/data/log/${doc.command.replace(
`${config.rootPath}/log/`,
'',
)}`,
},
{ where: { id: doc.id } },
);
}
if (doc.command.includes('/ql/db/')) {
if (doc.command.includes(`${config.rootPath}/config/`)) {
await CrontabModel.update(
{ command: `/ql/data/db/${doc.command.replace('/ql/db/', '')}` },
{
command: `${config.rootPath}/data/config/${doc.command.replace(
`${config.rootPath}/config/`,
'',
)}`,
},
{ where: { id: doc.id } },
);
}
if (doc.command.includes(`${config.rootPath}/db/`)) {
await CrontabModel.update(
{
command: `${config.rootPath}/data/db/${doc.command.replace(
`${config.rootPath}/db/`,
'',
)}`,
},
{ where: { id: doc.id } },
);
}