PostgreSQL registration starts and deactivates the Unload batch script

Source: Internet
Author: User
Tags goto

Register Start Pg_install.bat:

echo offset pgsql_dir=%~dp0if not "%pgsql_home%" = "" "(If not"%pgsql_home% "= ="%pgsql_dir% "(Echo pgsql_home=%p  Gsql_home%! = pgsql_dir=%pgsql_dir% goto pg_ends)) Else (set pgsql_home=%pgsql_dir% echo Pgsql_home must be set as pgsql_dir=%pgsql_dir%) set path=%pgsql_home%bin;%pgsql_home%lib;%path%pg_isready-h localhost 1>nul 2>    nul@if "%errorlevel%" = = "0" (Echo PostgreSQL is running. Goto pg_ends) echo "pgsql_home =%pgsql_home%" echo Install and start PostgreSQL server ... @if not exist%pgsql_home%data (m Kdir%pgsql_home%data%pgsql_home%bin/initdb--username=root--pgdata=%pgsql_home%data--encoding=UTF8--locale= Chineserem @if not "%errorlevel%" = = "0" (Rem there ERRORLEVEL is 2, but successfully initedrem Echo PostgreSQL Initdb FAI Led.rem goto Pg_endsrem)) pg_ctl Register--pgdata=%pgsql_home%data-n pgsql_srv-s demandnet start Pgsql_srvrem pg_ctl- W startpg_isready-h localhost 1>nul 2>nul@if "%errorlevel%" = = "0" (Echo PostgreSQL serveR started successfully) else (Echo Failed to start PostgreSQL server):p g_endscmd/k 


Deactivate uninstall Pg_stop.bat:

@echo off
echo Stop and uninstall PostgreSQL server ...
pg_isready-h localhost 1>nul 2>nul@if "%errorlevel%" = = "0" (net stop pgsql_srv)
Pg_ctl unregister-n pgsql_srv@if "%errorlevel%" = = "0" Echo Unregister PostgreSQL successfully
: My_ends


PostgreSQL Registration starts and deactivates the Unload batch script

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.