我正在尝试设置一个 PS1 脚本来自动安装 PostgreSQL。
- 停止 PostgreSQL
.\pg_ctl.exe -D "$PostgresInstallPath\data" stop
- 替换conf文件
Copy-Item -Path "$PSScriptRoot\postgresql.conf" -Destination "$PostgresInstallPath\data\postgresql.conf" -Force
- 启动 PostgreSQL
.\pg_ctl.exe -D "$PostgresInstallPath\data" start
我的自定义 conf 文件总是失败,但总是使用默认的 conf 文件。该文件在文本编辑器中打开时看起来并不正确,因此不知道为什么它不起作用。
有没有人看到过类似的东西,或者对我下一步可以去哪里让它工作有任何想法?
错误日志没有帮助,不仅仅是指每一行的错误。
2020-06-20 03:43:09.133 GMT [2104] LOG: syntax error in file "C:/Program Files/PostgreSQL/11/Data/postgresql.conf" line 1, near e
nd of line
2020-06-20 03:43:09.134 GMT [2104] LOG: syntax error in file "C:/Program Files/PostgreSQL/11/Data/postgresql.conf" line 2, near token ""
2020-06-20 03:43:09.134 GMT [2104] LOG: syntax error in file "C:/Program Files/PostgreSQL/11/Data/postgresql.conf" line 3, near token ""
2020-06-20 03:43:09.134 GMT [2104] LOG: syntax error in file "C:/Program Files/PostgreSQL/11/Data/postgresql.conf" line 4, near token ""
2020-06-20 03:43:09.134 GMT [2104] LOG: syntax error in file "C:/Program Files/PostgreSQL/11/Data/postgresql.conf" line 5, near token ""
2020-06-20 03:43:09.134 GMT [2104] LOG: syntax error in file "C:/Program Files/PostgreSQL/11/Data/postgresql.conf" line 6, near token ""
2020-06-20 03:43:09.134 GMT [2104] LOG: syntax error in file "C:/Program Files/PostgreSQL/11/Data/postgresql.conf" line 7, near token ""
2020-06-20 03:43:09.134 GMT [2104] LOG: syntax error in file "C:/Program Files/PostgreSQL/11/Data/postgresql.conf" line 8, near token ""
2020-06-20 03:43:09.135 GMT [2104] LOG: syntax error in file "C:/Program Files/PostgreSQL/11/Data/postgresql.conf" line 9, near token ""
2020-06-20 03:43:09.136 GMT [2104] LOG: syntax error in file "C:/Program Files/PostgreSQL/11/Data/postgresql.conf" line 10, near token ""
2020-06-20 03:43:09.136 GMT [2104] LOG: syntax error in file "C:/Program Files/PostgreSQL/11/Data/postgresql.conf" line 11, near token ""
2020-06-20 03:43:09.137 GMT [2104] LOG: syntax error in file "C:/Program Files/PostgreSQL/11/Data/postgresql.conf" line 12, near token ""
2020-06-20 03:43:09.138 GMT [2104] LOG: syntax error in file "C:/Program Files/PostgreSQL/11/Data/postgresql.conf" line 13, near token ""
2020-06-20 03:43:09.139 GMT [2104] LOG: syntax error in file "C:/Program Files/PostgreSQL/11/Data/postgresql.conf" line 14, near token ""
2020-06-20 03:43:09.139 GMT [2104] LOG: syntax error in file "C:/Program Files/PostgreSQL/11/Data/postgresql.conf" line 15, near token ""
2020-06-20 03:43:09.139 GMT [2104] LOG: syntax error in file "C:/Program Files/PostgreSQL/11/Data/postgresql.conf" line 16, near token ""
2020-06-20 03:43:09.139 GMT [2104] LOG: syntax error in file "C:/Program Files/PostgreSQL/11/Data/postgresql.conf" line 17, near token ""
2020-06-20 03:43:09.141 GMT [2104] LOG: syntax error in file "C:/Program Files/PostgreSQL/11/Data/postgresql.conf" line 18, near token ""
2020-06-20 03:43:09.142 GMT [2104] LOG: syntax error in file "C:/Program Files/PostgreSQL/11/Data/postgresql.conf" line 19, near token ""
2020-06-20 03:43:09.142 GMT [2104] LOG: syntax error in file "C:/Program Files/PostgreSQL/11/Data/postgresql.conf" line 20, near token ""
2020-06-20 03:43:09.142 GMT [2104] LOG: syntax error in file "C:/Program Files/PostgreSQL/11/Data/postgresql.conf" line 21, near token ""
2020-06-20 03:43:09.142 GMT [2104] LOG: syntax error in file "C:/Program Files/PostgreSQL/11/Data/postgresql.conf" line 22, near token ""
2020-06-20 03:43:09.143 GMT [2104] LOG: syntax error in file "C:/Program Files/PostgreSQL/11/Data/postgresql.conf" line 23, near token ""
2020-06-20 03:43:09.143 GMT [2104] LOG: syntax error in file "C:/Program Files/PostgreSQL/11/Data/postgresql.conf" line 24, near token ""
2020-06-20 03:43:09.143 GMT [2104] LOG: syntax error in file "C:/Program Files/PostgreSQL/11/Data/postgresql.conf" line 25, near token ""
2020-06-20 03:43:09.143 GMT [2104] LOG: syntax error in file "C:/Program Files/PostgreSQL/11/Data/postgresql.conf" line 26, near token ""
2020-06-20 03:43:09.143 GMT [2104] LOG: syntax error in file "C:/Program Files/PostgreSQL/11/Data/postgresql.conf" line 27, near token ""
2020-06-20 03:43:09.143 GMT [2104] LOG: syntax error in file "C:/Program Files/PostgreSQL/11/Data/postgresql.conf" line 28, near token ""
2020-06-20 03:43:09.144 GMT [2104] LOG: syntax error in file "C:/Program Files/PostgreSQL/11/Data/postgresql.conf" line 29, near token ""
2020-06-20 03:43:09.144 GMT [2104] LOG: syntax error in file "C:/Program Files/PostgreSQL/11/Data/postgresql.conf" line 30, near token ""
2020-06-20 03:43:09.144 GMT [2104] LOG: syntax error in file "C:/Program Files/PostgreSQL/11/Data/postgresql.conf" line 31, near token ""
2020-06-20 03:43:09.144 GMT [2104] LOG: syntax error in file "C:/Program Files/PostgreSQL/11/Data/postgresql.conf" line 32, near token ""
2020-06-20 03:43:09.145 GMT [2104] LOG: syntax error in file "C:/Program Files/PostgreSQL/11/Data/postgresql.conf" line 33, near token ""
2020-06-20 03:43:09.145 GMT [2104] FATAL: configuration file "C:/Program Files/PostgreSQL/11/Data/postgresql.conf" contains errors
postgresql.conf:
#------------------------------------------------------------------------------
# CONNECTIONS AND AUTHENTICATION
#------------------------------------------------------------------------------
listen_addresses = '*' # what IP address(es) to listen on;
port = 5432 # (change requires restart)
max_connections = 100 # (change requires restart)
#------------------------------------------------------------------------------
# RESOURCE USAGE (except WAL)
#------------------------------------------------------------------------------
dynamic_shared_memory_type = windows # the default is the first option
#------------------------------------------------------------------------------
# WRITE-AHEAD LOG
#------------------------------------------------------------------------------
max_wal_size = 1GB
min_wal_size = 80MB
#------------------------------------------------------------------------------
# REPORTING AND LOGGING
#------------------------------------------------------------------------------
log_destination = 'stderr' # Valid values are combinations of
logging_collector = on # Enable capturing of stderr and csvlog
log_file_mode = 0640 # creation mode for log files,
log_timezone = 'CET'
#------------------------------------------------------------------------------
# CLIENT CONNECTION DEFAULTS
#------------------------------------------------------------------------------
datestyle = 'iso, mdy'
timezone = 'CET'
lc_messages = 'English_United States.1252' # locale for system error message
lc_monetary = 'English_United States.1252' # locale for monetary formatting
lc_numeric = 'English_United States.1252' # locale for number formatting
lc_time = 'English_United States.1252' # locale for time formatting
default_text_search_config = 'pg_catalog.english'