-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck_postgres.bat
More file actions
44 lines (41 loc) · 1.16 KB
/
Copy pathcheck_postgres.bat
File metadata and controls
44 lines (41 loc) · 1.16 KB
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
34
35
36
37
38
39
40
41
42
43
44
@echo off
echo Checking PostgreSQL status...
echo.
REM Check if PostgreSQL service is running
sc query postgresql-x64-15 >nul 2>&1
if %errorlevel% equ 0 (
sc query postgresql-x64-15 | findstr /C:"RUNNING" >nul
if %errorlevel% equ 0 (
echo [OK] PostgreSQL service is running
) else (
echo [STOPPED] PostgreSQL service is not running
echo.
echo To start it, run as Administrator:
echo net start postgresql-x64-15
)
) else (
REM Try other common service names
sc query postgresql-x64-16 >nul 2>&1
if %errorlevel% equ 0 (
sc query postgresql-x64-16 | findstr /C:"RUNNING" >nul
if %errorlevel% equ 0 (
echo [OK] PostgreSQL service is running
) else (
echo [STOPPED] PostgreSQL service is not running
)
) else (
echo [UNKNOWN] Could not find PostgreSQL service
echo Please check if PostgreSQL is installed
)
)
echo.
echo Checking connection...
where psql >nul 2>&1
if %errorlevel% equ 0 (
echo [OK] psql command found
) else (
echo [WARNING] psql command not found in PATH
echo Add PostgreSQL bin directory to PATH
)
echo.
pause