如何编写一个 cron 表达式,其中 运行 在下午 12 点和 运行 每两个小时直到凌晨 12 点和每天 运行s 相同?
how to write a cron expression which run at 12 pm and run for every two hours till 12 am and runs everyday for same?
JobDetail Management = new JobDetail("Management", "NJobGroup", ClinicSubscription.class);
CronTrigger cr = new CronTrigger("ccr", "NJobGroup", "0 0 00 * * ?");
sche.scheduleJob(clinicManagement, cr);
午夜 (0
) 或每两小时 (/2
),从中午到晚上 10 点,包括在内 (12-22
):
0 0,12-22/2 * * * command.sh
JobDetail Management = new JobDetail("Management", "NJobGroup", ClinicSubscription.class);
CronTrigger cr = new CronTrigger("ccr", "NJobGroup", "0 0 00 * * ?"); sche.scheduleJob(clinicManagement, cr);
午夜 (0
) 或每两小时 (/2
),从中午到晚上 10 点,包括在内 (12-22
):
0 0,12-22/2 * * * command.sh