1.7.3 • Published 7 months ago

@websolutespa/payload-plugin-cron-job v1.7.3

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

@websolutespa/payload-plugin-cron-job

npm version

status alpha

Cron job plugin for PayloadCms.

Payload Cron job Plugin

A plugin for Payload CMS that adds collections and UI components to manage cron jobs with activity logs.

Requirements:

  • Payload version 2.28.0 or higher is required.

Installation

npm i @websolutespa/payload-plugin-cron-job

Usage

import { buildConfig } from 'payload/config';
import { clearLogs, cronJob } from '@websolutespa/payload-plugin-cron-job';

export default buildConfig({
  plugins: [
    cronJob({
      jobs: {
        alwaysOn: {
          execute: (payload: Payload) => {
            console.log('ScheduledTask.alwaysOn every 5 minutes');
          },
          cron: '*/5 * * * *',
        },
        clearLogs: {
          execute: async (payload: Payload) => {
            console.log('ScheduledTask.clearLogs every sunday at 01:00');
            return await clearLogs(payload);
          },
          cron: '0 1 * * 0',
        },
      },
    }),
  ]
});

Plugin options

propertydescription
jobsan object containing methods to run scheduled, each method is an object with an execute handler and a cron unix-cron string format

this library is for internal usage and not production ready
1.7.4-next.0

7 months ago

1.7.3

8 months ago

1.7.2

9 months ago

1.7.1

10 months ago

1.7.0

10 months ago

1.6.3

1 year ago

1.6.2

1 year ago

1.6.1

1 year ago

1.6.0

1 year ago

0.0.1

2 years ago