global class LogAutoSendSchedule implements Schedulable { global void execute(SchedulableContext SC) { Id execBTId = Database.executeBatch(new LogAutoSendBatch(), 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 oldcron = [select Id from CronTrigger where CronExpression = :CRON_EXP and CronJobDetail.Name like 'LogAutoSendSBG%']; if (oldcron.size() == 0) { System.schedule('LogAutoSendSBG' + CRON_EXP, CRON_EXP, new LogAutoSendSchedule()); } for (CronTrigger ct : [SELECT Id FROM CronTrigger WHERE State = 'DELETED' and CronJobDetail.Name like 'LogAutoSendSBG%']) { System.abortJob(ct.id); } } }