HR Module
Workers & Cron Jobs
Quartz.NET Scheduler & Cron

Quartz.NET Scheduler & Cron

Source: Scheduler.cs + AttendancePostService.cs

Scheduler Architecture

Cron Expression Breakdown

Cron: "0/30 * 7-23 * * ?"

┌─── Second:    0/30  → Every 30 seconds (0, 30)
│ ┌─ Minute:    *     → Every minute
│ │ ┌ Hour:     7-23  → Between 7:00 AM and 11:59 PM
│ │ │ ┌ Day:    *     → Every day of month
│ │ │ │ ┌ Month: *    → Every month
│ │ │ │ │ ┌ DOW:  ?   → Any day of week
│ │ │ │ │ │
0/30 * 7-23 * * ?

Execution Timeline

What Each Execution Does

Service Lifecycle

EventActionMethod
Windows Service StartInitialize Quartz scheduler, configure cron trigger, start firingScheduler.Run()
Every 30 seconds (7AM-11PM)Execute PunchTimingsJob → process all attendancePunchTimingsJob.Execute()
Windows Service StopGracefully shutdown Quartz schedulerScheduler.Stop()

Why every 30 seconds? The service continuously re-processes attendance so that any new biometric punches or mobile check-ins are immediately reflected in the daily attendance records. This means an employee who punches in at 10:15 AM will have their attendance calculated within 30 seconds.