global class LogAutoSendScheduleProduct implements Schedulable {
|
global void execute(SchedulableContext SC) {
|
Id execBTId = Database.executeBatch(new LogAutoSendBatchProduct(), 1);
|
}
|
|
public static void assignOneMinute() {
|
// delete 実行済み
|
Datetime addOneM = System.now().addMinutes(2);
|
String CRON_EXP = '0 ' + addOneM.minute() + ' ' + addOneM.hour() + ' ' + addOneM.day() + ' ' + addOneM.month() + ' ? ' + addOneM.year();
|
List<CronTrigger> oldcron = [select Id from CronTrigger where CronExpression = :CRON_EXP and CronJobDetail.Name like 'LogAutoSendProduct%'];
|
if (oldcron.size() == 0) {
|
System.schedule('LogAutoSendProduct' + CRON_EXP, CRON_EXP, new LogAutoSendScheduleProduct());
|
}
|
for (CronTrigger ct :
|
[SELECT Id FROM CronTrigger WHERE State = 'DELETED' and CronJobDetail.Name like 'LogAutoSendProduct%']) {
|
System.abortJob(ct.id);
|
}
|
}
|
}
|