# Run a job at a specific time/ CRON job

**URL:** https://discourse.orthanc-server.org/t/run-a-job-at-a-specific-time-cron-job/3517
**Category:** General
**Created:** [May 19, 2023, 7:58am UTC](https://discourse.orthanc-server.org/t/run-a-job-at-a-specific-time-cron-job/3517 "2023-05-19T07:58:15Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![sonaliayash](https://discourse.orthanc-server.org/user_avatar/discourse.orthanc-server.org/sonaliayash/32/1930_2.png) [@sonaliayash](https://discourse.orthanc-server.org/u/sonaliayash)
#### Post date: [May 19, 2023, 7:58am UTC](https://discourse.orthanc-server.org/t/run-a-job-at-a-specific-time-cron-job/3517/1 "2023-05-19T07:58:15Z")

</div>

Hi everyone,

Is there a way to run a job at a specific timestamp or a CRON job?

I was wondering if we could create a script in Lua/Python that creates jobs and only executes them at the time we provide, just like a CRON job.

Any help on this is super appreciated!

Regards,  
Yash

---

<div class="post-metadata">

### Author: ![jodogne](https://discourse.orthanc-server.org/user_avatar/discourse.orthanc-server.org/jodogne/32/1511_2.png) [@jodogne](https://discourse.orthanc-server.org/u/jodogne)
#### Post date: [May 19, 2023, 1:42pm UTC](https://discourse.orthanc-server.org/t/run-a-job-at-a-specific-time-cron-job/3517/2 "2023-05-19T13:42:36Z")

</div>

Hello,

I guess you are looking for the [sched module](https://docs.python.org/3/library/sched.html) in Python. This module should be compatible with [Python plugins for Orthanc](https://book.orthanc-server.com/plugins/python.html).

Kind Regards,  
Sébastien-

---

<div class="post-metadata">

### Author: ![sdscotti](https://discourse.orthanc-server.org/user_avatar/discourse.orthanc-server.org/sdscotti/32/2563_2.png) [@sdscotti](https://discourse.orthanc-server.org/u/sdscotti)
#### Post date: [June 13, 2023, 8:57am UTC](https://discourse.orthanc-server.org/t/run-a-job-at-a-specific-time-cron-job/3517/3 "2023-06-13T08:57:18Z")

</div>

I think you are referring to running Orthanc jobs in your post, but this is also helpful for running DB backups and other things that might not be directly related to Orthanc but part of your Docker Package.

You actually can create a docker container to run CRON jobs, although the Python method that Sebastian mentions might be better in some cases.

There is a reference here about using Docker for that:

> **[Cron + Docker = The Easiest Job Scheduler You’ll Ever Create](https://levelup.gitconnected.com/cron-docker-the-easiest-job-scheduler-youll-ever-create-e1753eb5ea44)**
>
> Two component for maximum power and flexibility.

I have used that sometimes and it works pretty well if it is on the same Docker Network as your other containers (i.e. Postgres and MySQL, etc.) because it can also perform DB backups without needing to rely on the host system setup, and it keeps everything still pretty much isolated to the Docker package and network.

/sds
