Fix cron path: read from shared-context
This commit is contained in:
@@ -41,17 +41,24 @@ export async function GET(request: Request) {
|
||||
return NextResponse.json(tasks);
|
||||
}
|
||||
|
||||
// CRONS - from workspace-neo
|
||||
// CRONS - from shared-context
|
||||
if (type === 'crons') {
|
||||
const cronFile = path.join(DATA_DIR, 'workspace-neo/.openclaw/cron/jobs.json');
|
||||
if (fs.existsSync(cronFile)) {
|
||||
const data = JSON.parse(fs.readFileSync(cronFile, 'utf-8'));
|
||||
const jobs: CronJob[] = (data.jobs || []).map((job: any) => ({
|
||||
name: job.name,
|
||||
enabled: job.enabled,
|
||||
status: job.state?.lastStatus || 'unknown'
|
||||
}));
|
||||
return NextResponse.json(jobs);
|
||||
// Try multiple paths for cron jobs
|
||||
const cronPaths = [
|
||||
path.join(DATA_DIR, 'shared-context/.openclaw/cron/jobs.json'),
|
||||
path.join(DATA_DIR, 'workspace-neo/.openclaw/cron/jobs.json'),
|
||||
];
|
||||
|
||||
for (const cronFile of cronPaths) {
|
||||
if (fs.existsSync(cronFile)) {
|
||||
const data = JSON.parse(fs.readFileSync(cronFile, 'utf-8'));
|
||||
const jobs: CronJob[] = (data.jobs || []).map((job: any) => ({
|
||||
name: job.name,
|
||||
enabled: job.enabled,
|
||||
status: job.state?.lastStatus || 'unknown'
|
||||
}));
|
||||
return NextResponse.json(jobs);
|
||||
}
|
||||
}
|
||||
return NextResponse.json([]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user