Decompression version of PostgreSQL startup script

Source: Internet
Author: User
Tags postgresql
Postgresql.cmd


@echo off
title PostgreSQL

rem variable setting
if not defined PGSQL set PGSQL =% ~ dp0
if not defined PGLOCALDIR set PGLOCALDIR =% PGSQL% share
if not defined PGDATABASE set PGDATABASE = postgres
if not defined PGPORT set PGPORT = 5432
if not defined PGUSER set PGUSER = postgres
rem data directory, set as needed
if not defined PGDATA set PGDATA =% PGSQL% \ Data \ data
rem log, set on demand
if not defined PGLOG set PGLOG =% PGSQL% \ Data \ log.txt

rem runs for the first time to initialize a new database
if not exist "% PGDATA%" (
     echo.
     Echo is initializing the database for the first time, please wait ...
     "% PGSQL% \ bin \ initdb" -U% PGUSER% -A trust -E utf8 --locale = C> nul
)

rem start postgres server
echo.
"% PGSQL% \ bin \ pg_ctl" -D "% PGDATA%" -l "% PGLOG%" -w start
cls
echo.
echo Type \ q to exit and shut down the server
echo.
"% PGSQL% \ bin \ psql.exe" --port =% PGPORT% --dbname = "% PGDATABASE%" --username = "% PGUSER%"
echo.
"% PGSQL% \ bin \ pg_ctl" -D "% PGDATA%" stop 

Decompression version of PostgreSQL startup 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.