从c#编辑postgresql.conf文件

时间:2015-08-24 14:19:02

标签: c# postgresql

我在c#中创建一个Windows服务应用程序来自动化PostGreSql数据库备份。 (使用计划任务执行完整备份,清理旧文件,...)

要做到这一点,我首先需要编辑postgresql.conf文件,取消注释一些参数并更改一些值以启用预写日志记录(WAL)。

我想从我的代码中自动执行此操作。有没有简单的方法或现有的代码呢?

我找到了this Linux script,但我需要从C#...

开始

要编辑的参数示例:

# - Archiving -                                       

archive_mode = on                          

archive_command = 'copy "%p" "C:\\Backups\\%f"'                            

archive_timeout = 600 # force a logfile segment switch after this number of seconds

这种配置文件是否有标准名称?

1 个答案:

答案 0 :(得分:1)

听起来你想要打开文件,做一个"发现&替换"然后保存更改。

这就是你要做的。 How to Find And Replace Text In A File With C#

相关问题