[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: postgresql non si avvia



Buongiorno Federico,

> # systemctl status -l postgresql
[...]
> feb 23 22:22:30 laptop systemd[22652]: Failed at step EXEC
> spawning /usr/bin/postgresql-check-db-dir: No such file or directory
[...]
> 
qui dice che il tuo systemd, prima di attivare postgresql, esegue il
comando /usr/bin/postgresql-check-db-dir, che però sul tuo sistema non
c'è. A dire il vedo non c'è in nessuna distribuzione Debian, quindi mi
sa che la tua configurazione del servizio postgresql in systemd è
sbagliata.

Questa è quella che arriva, standard, con Debian:

--------------------- file 1 --------------------
$ cat /lib/systemd/system/postgresql.service
# systemd service for managing all PostgreSQL clusters on the system. This
# service is actually a systemd target, but we are using a service since
# targets cannot be reloaded.

[Unit]
Description=PostgreSQL RDBMS

[Service]
Type=oneshot
ExecStart=/bin/true
ExecReload=/bin/true
RemainAfterExit=on

[Install]
WantedBy=multi-user.target

--------------------- file 2 --------------------
$ cat /lib/systemd/system/postgresql@.service
# systemd service template for PostgreSQL clusters. The actual instances will
# be called "postgresql@version-cluster", e.g. "postgresql@9.3-main". The
# variable %i expands to "version-cluster", %I expands to "version/cluster".
# (%I breaks for cluster names containing dashes.)

[Unit]
Description=PostgreSQL Cluster %i
ConditionPathExists=/etc/postgresql/%I/postgresql.conf
PartOf=postgresql.service
ReloadPropagatedFrom=postgresql.service
Before=postgresql.service

[Service]
Type=forking
# @: use "postgresql@%i" as process name
ExecStart=@/usr/bin/pg_ctlcluster postgresql@%i %i start
ExecStop=/usr/bin/pg_ctlcluster -m fast %i stop
ExecReload=/usr/bin/pg_ctlcluster %i reload
PIDFile=/var/run/postgresql/%i.pid
SyslogIdentifier=postgresql@%i
# restarting automatically will prevent "pg_ctlcluster ... stop" from working,
# so we disable it here. Also, the postmaster will restart by itself on most
# problems anyway, so it is questionable if one wants to enable external
# automatic restarts.
#Restart=on-failure
# (This should make pg_ctlcluster stop work, but doesn't:)
#RestartPreventExitStatus=SIGINT SIGTERM

[Install]
WantedBy=multi-user.target

Questi file fanno parte del pacchetto postgresql-common che puoi provare
a reinstallare, eventualmente.

Ciao,
Giuseppe


Reply to: