0

I'm creating a Windows Service application in c# to automate PostGreSql database backups. (With scheduled tasks to do full backups, clean old files, ...)

To do it, I first need to edit the postgresql.conf file, uncomment some parameters and change some values to enable Write-Ahead Logging ( WAL ).

I would like to do it automatically from my code. Is there a simple way or existing code to do it ?

I found this Linux script but I need to do it from C#...

Example of parameters to edit:

# - Archiving -                                       

archive_mode = on                          

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

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

Is there a standard name for this kind of configuration file ?

1 Answer 1

1

Sounds like you want to open the file, do a "find & replace" then save the changes.

This is how you would do that. How to Find And Replace Text In A File With C#

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.