# How to schedule jobs with Quartz on Ktor

DevFeed: [How to schedule jobs with Quartz on Ktor](<https://devfeed.tech/articles/how-to-schedule-jobs-with-quartz-on-ktor-25567.md>)

Original publisher: [Read original article](<https://www.marcogomiero.com/posts/2022/ktor-jobs-quartz/>)

Author: Marco Gomiero

Published: 2022-04-22T00:00:00Z

Content type: tutorial

Language: en

Sources: [Posts on Marco Gomiero](<https://devfeed.tech/sources/posts-on-marco-gomiero.md>)

Topics: [Quartz](<https://devfeed.tech/topics/quartz.md>), [Ktor](<https://devfeed.tech/topics/ktor.md>), [Persistence](<https://devfeed.tech/topics/persistence.md>), [scheduling](<https://devfeed.tech/topics/scheduling.md>)

Tags: [backend](<https://devfeed.tech/tags/backend.md>), [background](<https://devfeed.tech/tags/background.md>), [backup](<https://devfeed.tech/tags/backup.md>), [content](<https://devfeed.tech/tags/content.md>), [cron](<https://devfeed.tech/tags/cron.md>), [database](<https://devfeed.tech/tags/database.md>), [development](<https://devfeed.tech/tags/development.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [jobs](<https://devfeed.tech/tags/jobs.md>), [ktor](<https://devfeed.tech/tags/ktor.md>), [maintenance](<https://devfeed.tech/tags/maintenance.md>), [migrations](<https://devfeed.tech/tags/migrations.md>), [persistence](<https://devfeed.tech/tags/persistence.md>), [project](<https://devfeed.tech/tags/project.md>), [quartz](<https://devfeed.tech/tags/quartz.md>), [schedule](<https://devfeed.tech/tags/schedule.md>), [scheduled](<https://devfeed.tech/tags/scheduled.md>), [scheduling](<https://devfeed.tech/tags/scheduling.md>), [series](<https://devfeed.tech/tags/series.md>), [server](<https://devfeed.tech/tags/server.md>)

## AI overview

The excerpt explains that Quartz can schedule recurring backend tasks and persist job state in a database so jobs can be restored after a server reboot. For a Ktor project, setup involves adding the Quartz dependency and creating its required database tables from the supplied schema files; the example uses MySQL. Quartz logging can be made less verbose by lowering the logging level for Quartz classes. The author notes that Quartz offers many features and settings, and presents only the configuration that worked for their project. The excerpt ends as the article begins describing the Scheduler, so it does not provide the subsequent implementation details.

## Source excerpt

SERIES: Building a backend with Ktor Part 1: Structuring a Ktor project Part 2: How to persist Ktor logs Part 3: How to use an in-memory database for testing on Ktor Part 4: How to handle database migrations with Liquibase on Ktor Part 5: Generate API documentation from Swagger on Ktor Part 6: How to schedule jobs with Quartz on Ktor Part 7: Moving from mobile to backend development with Ktor Sometimes, on a backend project, there is the need to run one or more tasks periodically, like for system administration, maintenance, backup, syncing content in the background, etc. These types of tasks can be scheduled "manually" with a cron job or with a scheduling library like Quartz, that makes easy for example the persistence of the task's state even after a reboot of the server.