removeJob
Remove a scheduled job (cronjob) from the job manager.
Import
import { removeJob } from '@evershop/evershop/lib/cronjob';
Syntax
removeJob(jobName: string): boolean
Parameters
jobName
Type: string
The name of the job to remove.
Return Value
Returns boolean:
trueif the job was successfully removedfalseif the job was not found
Examples
Basic Usage
import { removeJob } from '@evershop/evershop/lib/cronjob';
export default function bootstrap() {
// Remove a job
removeJob('old_cleanup_job');
}
Bootstrap Location
Jobs must be removed in the bootstrap file:
// extensions/my-extension/bootstrap.ts
import { removeJob } from '@evershop/evershop/lib/cronjob';
export default function bootstrap() {
// Remove a core job you don't want to run
removeJob('core_cleanup_job');
}
Notes
- Must be called during bootstrap phase before the job manager is frozen
- It will no longer be scheduled or executed
- The job file remains on disk but won't be loaded
- The removal is permanent for the current application lifecycle
See Also
- registerJob - Register a new job
- updateJobSchedule - Update job schedule