aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Wagin <dmitry.wagin@ya.ru>2023-04-23 15:28:39 +0000
committerRobert Clausecker <fuz@FreeBSD.org>2023-04-23 17:17:49 +0000
commite7de14f3bb723e71746fb2179aafbe8d897c0b62 (patch)
treef34d4a0c05710e1cd9dab0b85c1ce51f416b9b66
parentf063894478921e173efe33f8efbfffc1b7425088 (diff)
downloadports-e7de14f3bb723e71746fb2179aafbe8d897c0b62.tar.gz
ports-e7de14f3bb723e71746fb2179aafbe8d897c0b62.zip
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
-rw-r--r--databases/pgbouncer/Makefile1
-rw-r--r--databases/pgbouncer/files/pgbouncer.in18
2 files changed, 18 insertions, 1 deletions
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"