Re: Arranque automático

From: "Guillermo E(dot) Villanueva" <guillermovil(at)gmail(dot)com>
To: Juan José Santamaría Flecha <juanjo(dot)santamaria(at)gmail(dot)com>
Cc: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, pgsql-es-ayuda <pgsql-es-ayuda(at)postgresql(dot)org>
Subject: Re: Arranque automático
Date: 2020-03-10 18:26:00
Message-ID: CANm+PCDpXMq=ys=yT+_HawYbF9aAzA6VVNXChoKgKTwzcoS0rw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda

Muchas gracias a todos por la ayuda, lo solucioné creando el archivo
/etc/systemd/system/postgres.service.
Con el siguiente contenido:
[Unit]
Description=PostgreSQL database server
After=network.target

[Service]
Type=forking

User=postgres
Group=postgres

# Where to send early-startup messages from the server (before the logging
# options of postgresql.conf take effect)
# This is normally controlled by the global default set by systemd
# StandardOutput=syslog

# Disable OOM kill on the postmaster
OOMScoreAdjust=-1000
# ... but allow it still to be effective for child processes
# (note that these settings are ignored by Postgres releases before 9.5)
Environment=PG_OOM_ADJUST_FILE=/proc/self/oom_score_adj
Environment=PG_OOM_ADJUST_VALUE=0

# Maximum number of seconds pg_ctl will wait for postgres to start. Note
that
# PGSTARTTIMEOUT should be less than TimeoutSec value.
Environment=PGSTARTTIMEOUT=270

Environment=PGDATA=/usr/local/pgsql/data

ExecStart=/usr/local/pgsql/bin/pg_ctl start -D ${PGDATA} -s -w -t
${PGSTARTTIMEOUT}
ExecStop=/usr/local/pgsql/bin/pg_ctl stop -D ${PGDATA} -s -m fast
ExecReload=/usr/local/pgsql/bin/pg_ctl reload -D ${PGDATA} -s

# Give a reasonable amount of time for the server to start up/shut down.
# Ideally, the timeout for starting PostgreSQL server should be handled more
# nicely by pg_ctl in ExecStart, so keep its timeout smaller than this
value.
TimeoutSec=300

[Install]
WantedBy=multi-user.target

Luego ejecuté los comandos:

systemctl daemon-reload
systemctl enable postgres
systemctl start postgres

El mar., 10 mar. 2020 a las 11:53, Juan José Santamaría Flecha (<
juanjo(dot)santamaria(at)gmail(dot)com>) escribió:

>
> On Tue, Mar 10, 2020 at 3:44 PM Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
> wrote:
>
>> Guillermo E. Villanueva escribió:
>>
>> > El lun., 9 mar. 2020 a las 14:45, Alvaro Herrera (<
>> alvherre(at)2ndquadrant(dot)com>)
>> > escribió:
>>
>> > > Hmm, esto está desactualizado. Deberías estar usando el archivo
>> > > .service para systemd, no los scripts antiguos sysv.
>> > >
>> > *Yo estaba usando el que descargué junto con los fuentes del directorio
>> > contrib el .service también está disponible junto con los fuentes?*
>>
>> No, viene con paquetes. Puedes copiarlo de allá.
>>
>
> También tienes un ejemplo en la documentación:
>
> https://www.postgresql.org/docs/current/server-start.html
>
> Tal vez sea mejor intentar ajustar ese a tu entorno.
>
> Un saludo,
>
> Juan José Santamaría Flecha
>

In response to

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message Jaime Casanova 2020-03-15 15:22:24 Re: Query se demora 1351 minutos
Previous Message Juan José Santamaría Flecha 2020-03-10 14:53:44 Re: Arranque automático