git: e7de14f3bb72 - main - databases/pgbouncer: add a graceful stop command to rc script
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 23 Apr 2023 17:19:23 UTC
The branch main has been updated by fuz: URL: https://cgit.FreeBSD.org/ports/commit/?id=e7de14f3bb723e71746fb2179aafbe8d897c0b62 commit e7de14f3bb723e71746fb2179aafbe8d897c0b62 Author: Dmitry Wagin <dmitry.wagin@ya.ru> AuthorDate: 2023-04-23 15:28:39 +0000 Commit: Robert Clausecker <fuz@FreeBSD.org> CommitDate: 2023-04-23 17:17:49 +0000 databases/pgbouncer: add a graceful stop command to rc script The user can now terminate pgbouncer both with gracefulstop (sends SIGINT) and with stop (sends SIGTERM). PR: 271023 --- databases/pgbouncer/Makefile | 1 + databases/pgbouncer/files/pgbouncer.in | 18 +++++++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/databases/pgbouncer/Makefile b/databases/pgbouncer/Makefile index f157b30ea9bd..391de975a740 100644 --- a/databases/pgbouncer/Makefile +++ b/databases/pgbouncer/Makefile @@ -1,5 +1,6 @@ PORTNAME= pgbouncer PORTVERSION= 1.18.0 +PORTREVISION= 1 CATEGORIES= databases MASTER_SITES= https://pgbouncer.github.io/downloads/files/${PORTVERSION}/ \ http://pgbouncer.github.io/downloads/files/${PORTVERSION}/ diff --git a/databases/pgbouncer/files/pgbouncer.in b/databases/pgbouncer/files/pgbouncer.in index 5abb3925c2cc..ded6ed6cc112 100644 --- a/databases/pgbouncer/files/pgbouncer.in +++ b/databases/pgbouncer/files/pgbouncer.in @@ -13,6 +13,7 @@ # Default is "%%PREFIX%%/etc/pgbouncer.ini". # pgbouncer_flags (string): Additional flags passed to pgbouncer. # Default is "". +# pgbouncer_sig_stop (str): Default to "TERM" . /etc/rc.subr @@ -24,11 +25,26 @@ load_rc_config "$name" : ${pgbouncer_user="pgbouncer"} : ${pgbouncer_conf="%%PREFIX%%/etc/$name.ini"} -extra_commands="reload" +gracefulstop_cmd="pgbouncer_gracefulstop" +stop_precmd="pgbouncer_prestop" + +extra_commands="reload gracefulstop" command="%%PREFIX%%/bin/pgbouncer" pidfile="%%PGBOUNCER_RUNDIR%%/$name.pid" required_files="${pgbouncer_conf}" command_args="-d ${pgbouncer_conf}" +pgbouncer_gracefulstop() +{ + echo "Performing a graceful stop:" + sig_stop="INT" + run_rc_command ${rc_prefix}stop ${rc_extra_args} || return 1 +} + +pgbouncer_prestop() +{ + sig_stop="${pgbouncer_sig_stop:-TERM}" +} + run_rc_command "$1"