From 9ee7d3659b4b9c8fb983881c32c242b27a5d8a41 Mon Sep 17 00:00:00 2001 From: f Date: Sat, 4 Feb 2023 19:37:00 -0300 Subject: [PATCH] fix: let postgresql handle its pidfile --- monit.conf | 2 +- postgresql.conf | 2 +- postgresqld.sh | 3 --- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/monit.conf b/monit.conf index f46e079..269efb5 100644 --- a/monit.conf +++ b/monit.conf @@ -1,4 +1,4 @@ -check process postgresql with pidfile /run/postgresql.pid +check process postgresql with pidfile /run/postgresql/pid start program = "/usr/local/bin/postgresqld start" stop program = "/usr/local/bin/postgresqld stop" if failed port 5432 protocol pgsql for 3 times within 5 cycles then restart diff --git a/postgresql.conf b/postgresql.conf index a07cd97..669dab3 100644 --- a/postgresql.conf +++ b/postgresql.conf @@ -1,5 +1,5 @@ listen_addresses = '*' -external_pid_file = '/run/postgresql.pid' +external_pid_file = '/run/postgresql/pid' log_destination = 'syslog' log_checkpoints = on log_connections = on diff --git a/postgresqld.sh b/postgresqld.sh index 5577f24..feb2fb2 100755 --- a/postgresqld.sh +++ b/postgresqld.sh @@ -9,8 +9,6 @@ case $1 in reload) su ${user} -c "pg_ctl reload -D ${PGDATA}" ;; *) - pid=/run/postgresql.pid - install -dm 2750 -o ${user} -g ${user} /run/postgresql chown -R ${user}:${user} ${PGBASE} @@ -20,7 +18,6 @@ case $1 in echo "include_dir = '/etc/postgres.d'" >> ${PGDATA}/postgresql.conf fi - rm -f ${pid} daemonize -u ${user} -c ${PGDATA} /usr/bin/postgres ;; esac