# Cron- functionality

Cron is a time-based job scheduler. DBSync uses cron to schedule jobs to run periodically at fixed times, dates or intervals.

The cron is a long-running process that executes commands at specific dates and times. You can use this to schedule activities, either as one-time events or as recurring tasks.

## **Timing Syntax** <a href="#cron-functionality-timingsyntax" id="cron-functionality-timingsyntax"></a>

Cron determines how often and when the cron job is going to run.

It consists of five parts:

1. Minute
2. Hour
3. Day of month
4. Month
5. Day of week

![](https://help.mydbsync.com/docs/download/attachments/53903485/cron.PNG?version=1\&modificationDate=1619726204000\&api=v2)

## **Examples based on the above "commands to execute"** <a href="#cron-functionality-examplesbasedontheabove-commandstoexecute" id="cron-functionality-examplesbasedontheabove-commandstoexecute"></a>

This cron job will run every minute, all the time

\* \* \* \* \* \[command]

This cron job will run at minute zero, every hour (i.e. an hourly cron job)

0 \* \* \* \* \[command]

This will run once a month, on the second day of the month at midnight (i.e. January 2nd 12:00am, February 2nd 12:00am etc.)

0 0 2 \* \* \[command]

This will run on Mondays, every hour (i.e. 24 times in one day, but only on Mondays)

0 \* \* \* 1 \[command]\
The below commands need to add in the system.properties to execute the cron- functionality.

Add these 2 commands in system.properties

log.maxcount=\
log.cleaner.cron =

### **Example 1**

Default Auto log deletion parameters (To do the custom changes then change the parameters in system.properties)&#x20;

***log.maxcount=** ( DBSync default log.maxcount=6000, As based on the above explanation please follow the timing syntax to add the max count- (i.e To limit the count of the logs generated)*\
\&#xNAN;***log.cleaner.cron =** (It is based on the user's requirements, please follow the timing syntax to clean all the successful log files one by one as per the given specified parameter for log.cleaner.cron).*

![](https://help.mydbsync.com/docs/download/attachments/53903485/Cron12.PNG?version=1\&modificationDate=1619726204000\&api=v2)

{% hint style="info" %}
Now you can change the above properties like ***log.maxcount and log.cleaner.cron*** for further changes in the profile for the log screen.
{% endhint %}

Users can change these 2 properties to go to the ***system.properties*** and make the changes.

### **Example 2**&#x20;

See the details below:

* ***log.maxcount=4***&#x20;
* ***log.cleaner.cron=0 0/5 \* \* \* ?***\
  \
  \&#xNAN;***log.maxcount=4 means if a user running Cleancopy or any other command with help of scheduler like:***
  * ***Command - Clean copy***
  * ***Minutes - 1 minute***
* Then, you have to wait for every one minute the command executes and runs the sync. Users will see on the log page that logs are generating in every one minute.
* After 5 mins the page will get refreshed and the user will see the deleted logs from the UI and h2 database as well. All the deleted logs are permanently deleted from the h2 database and from the UI.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.mydbsync.com/cloud-replication-main/schedule-jobs/cron-functionality.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
