Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- AgendarSchedulesCheckin abc = new AgendarSchedulesCheckin();
- abc.execute(null);
- global class AgendarSchedulesCheckin Implements Schedulable {
- global void execute(SchedulableContext sc)
- {
- Datetime horaAtual = datetime.now();
- Date dataAtual = horaAtual.date();
- Integer horaJob = horaAtual.hour();
- Integer diaJob;
- Integer mesJob;
- if(horaJob == 23){
- dataAtual = dataAtual+1;
- horaJob = 0;
- }
- diaJob = dataAtual.day();
- mesJob = dataAtual.month();
- String cron_exp = '0 44 '+horaJob+' '+diaJob+' '+mesJob+' ?';
- String jobName = 'jobTeste';
- System.Schedule(jobName, cron_exp, new AgendarSchedulesCheckin());
- Integer horaAux = 45;
- for(Integer x = 0; x < 3; x++){
- cron_exp = '0 '+horaAux+' '+horaJob+' '+diaJob+' '+mesJob+' ?';
- jobName = 'jobTeste '+x;
- System.Schedule(jobName, cron_exp, new DeletarSemCheckinSchedule());
- horaAux = horaAux+3;
- }
- }
- }
Add Comment
Please, Sign In to add comment