-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMake-Cluster.bat
More file actions
33 lines (26 loc) · 854 Bytes
/
Make-Cluster.bat
File metadata and controls
33 lines (26 loc) · 854 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
@echo off
chcp 65001 > nul 2>&1
setlocal enabledelayedexpansion
set "ClusterName=data"
set /P "ClusterName=Enter the cluster name (or press Enter to use 'data'): "
set "ClusterPath=%CD%\%ClusterName%"
if exist "%ClusterPath%" (
choice /M "The cluster directory already exists. Do you want to delete it and continue?"
if errorlevel 2 (
echo The user chose not to delete the existing directory. Exiting the script.
pause
exit /b
) else (
echo Deleting the existing directory...
rmdir /s /q "%ClusterPath%"
)
)
"%CD%\bin\initdb" -D "%ClusterPath%" -U postgres -W --encoding=UTF8
if errorlevel 1 (
echo Failed to create the cluster. Exiting.
pause
exit /b
)
echo %ClusterName% > "%CD%\cluster_name.txt"
echo Cluster created at '%ClusterPath%'.
pause