mirror of
https://github.com/whyour/qinglong.git
synced 2025-05-22 22:36:06 +08:00
37 lines
822 B
TypeScript
37 lines
822 B
TypeScript
export class Crontab {
|
|
name?: string;
|
|
command: string;
|
|
schedule: string;
|
|
timestamp?: string;
|
|
created?: number;
|
|
saved?: boolean;
|
|
_id?: string;
|
|
status?: CrontabStatus;
|
|
isSystem?: 1 | 0;
|
|
pid?: number;
|
|
isDisabled?: 1 | 0;
|
|
|
|
constructor(options: Crontab) {
|
|
this.name = options.name;
|
|
this.command = options.command;
|
|
this.schedule = options.schedule;
|
|
this.saved = options.saved;
|
|
this._id = options._id;
|
|
this.created = options.created;
|
|
this.status = CrontabStatus[options.status]
|
|
? options.status
|
|
: CrontabStatus.idle;
|
|
this.timestamp = new Date().toString();
|
|
this.isSystem = options.isSystem || 0;
|
|
this.pid = options.pid;
|
|
this.isDisabled = options.isDisabled || 0;
|
|
}
|
|
}
|
|
|
|
export enum CrontabStatus {
|
|
'running',
|
|
'idle',
|
|
'disabled',
|
|
'queued',
|
|
}
|