# 自动执行数据备份与恢复

```
 配置文件路径：o2server/config/node_127.0.0.1.json
```

{\
&#x20; ......

&#x20;  **//数据库导出备份相关配置**\
&#x20;  "dumpData":{                                           \
&#x20;    "cron" : "0 0 21 \* \* ?",                            //数据库导出备份执行的时间周期，Cron表达式\
&#x20;    "size" : 14                                              //数据库导出备份文件保留的最大个数\
&#x20;  }, **//文件导出备份相关配置**\
&#x20;  "dumpStorage":{                                     \
&#x20;    "cron" : "0 0 21 \* \* ?",                            //文件存储导出备份执行的时间周期，Cron表达式\
&#x20;    "size" : 14                                              //文件存储导出备份文件保留的最大个数\
&#x20;  }\
&#x20;}

备份文件存放位置：o2server\local\backup

![](/files/-LmXipvUdi-JSZjDXJaW)

配置说明：

1、参数cron：O2OA采用通用的CRON时间表达式来实现对任务执行周期 的设定。CRON表达式相关的说明，请参见：<https://www.cnblogs.com/javahr/p/8318728.html>

&#x20;    常用的CRON表达式：    &#x20;

| <p>（1）0 0 2 1 \* ? \*   表示在每月的1日的凌晨2点调整任务<br> （2）0 15 10 ? \* MON-FRI   表示周一到周五每天上午10:15执行作业<br> （3）0 15 10 ? 6L 2002-2006   表示2002-2006年的每个月的最后一个星期五上午10:15执行作<br> （4）0 0 10,14,16 \* \* ?   每天上午10点，下午2点，4点 <br> （5）0 0/30 9-17 \* \* ?   朝九晚五工作时间内每半小时 <br> （6）0 0 12 ? \* WED    表示每个星期三中午12点 <br> （7）0 0 12 \* \* ?   每天中午12点触发 <br> （8）0 15 10 ? \* \*    每天上午10:15触发 <br> （9）0 15 10 \* \* ?     每天上午10:15触发 <br> （10）0 15 10 \* \* ? \*    每天上午10:15触发 <br> （11）0 15 10 \* \* ? 2005    2005年的每天上午10:15触发 <br> （12）0 \* 14 \* \* ?     在每天下午2点到下午2:59期间的每1分钟触发 <br> （13）0 0/5 14 \* \* ?    在每天下午2点到下午2:55期间的每5分钟触发 <br> （14）0 0/5 14,18 \* \* ?     在每天下午2点到2:55期间和下午6点到6:55期间的每5分钟触发 <br> （15）0 0-5 14 \* \* ?    在每天下午2点到下午2:05期间的每1分钟触发 <br> （16）0 10,44 14 ? 3 WED    每年三月的星期三的下午2:10和2:44触发 <br> （17）0 15 10 ? \* MON-FRI    周一至周五的上午10:15触发 <br> （18）0 15 10 15 \* ?    每月15日上午10:15触发 <br> （19）0 15 10 L \* ?    每月最后一日的上午10:15触发 <br> （20）0 15 10 ? \* 6L    每月的最后一个星期五上午10:15触发 <br> （21）0 15 10 ? \* 6L 2002-2005   2002年至2005年的每月的最后一个星期五上午10:15触发 <br> （22）0 15 10 ? \* 6#3   每月的第三个星期五上午10:15触发</p> |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

**2、参数size：因为考虑到备份对磁盘容量的消夏，O2OA支持只保留指定数量的备份文件。超过size指定数量的备份文件时，最早的备份文件将会被删除。**


---

# 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://o2oa.gitbook.io/course/ping-tai-shi-shi/wei-hu-gong-ju/zi-dong-bei-fen-shu-ju.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.
