Skip to content

Commit 1c8af56

Browse files
committed
chore: wip
1 parent 763e357 commit 1c8af56

File tree

3 files changed

+16
-18
lines changed

3 files changed

+16
-18
lines changed

.stacks/core/types/src/cron-jobs.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ export interface CronJobOptions {
66
* The name of the cron job.
77
*/
88
name?: string
9-
action: string | Function
10-
schedule: string
9+
action?: string | Function
10+
run?: string | Function
11+
schedule?: string
1112
description?: string
1213
enabled?: boolean
1314
timezone?: string

app/jobs/demo-job.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { log } from '@stacksjs/cli'
2+
import { Every } from '@stacksjs/types'
3+
import type { CronJob } from '@stacksjs/types'
4+
5+
export default {
6+
name: 'Demo Job', // defaults to the file name
7+
description: 'A demo cron job that runs every 5th minute', // optional
8+
schedule: Every.FifthMinute, // optional, run it on a schedule. alternatively, '*/5 * * * *'
9+
run: () => { // or `action: () => {`
10+
log.info('This cron job runs at every 5th minute')
11+
},
12+
// `run: 'demo-job'` is another option where `demo-job` refers to ./resources/functions/demo-job.ts
13+
} satisfies CronJob

app/jobs/index.ts

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)