9c64539
From d3bf52f5dc9e465faba69a85eeed5b64916efddd Mon Sep 17 00:00:00 2001
9c64539
From: Zdenek Dohnal <zdohnal@redhat.com>
9c64539
Date: Mon, 29 Nov 2021 09:30:26 +0100
9c64539
Subject: [PATCH] Add --with-idle-exit-timeout configure option
9c64539
9c64539
The option enables setting IdleExitTimeout to a desired value - f.e.
9c64539
setting to zero will disable automatic shutdown, which is useful on servers,
9c64539
where cupsd is expected to run even if there is no web interface, no jobs
9c64539
and CUPS doesn't share queues.
9c64539
---
9c64539
 CHANGES.md                      |  1 +
9c64539
 conf/cupsd.conf.in              |  3 +++
9c64539
 config-scripts/cups-defaults.m4 | 13 +++++++++++++
9c64539
 configure                       | 30 ++++++++++++++++++++++++++++++
9c64539
 4 files changed, 47 insertions(+)
9c64539
9c64539
diff --git a/conf/cupsd.conf.in b/conf/cupsd.conf.in
9c64539
index 03d1d5df5..b25884907 100644
9c64539
--- a/conf/cupsd.conf.in
9c64539
+++ b/conf/cupsd.conf.in
9c64539
@@ -28,6 +28,9 @@ DefaultAuthType Basic
9c64539
 # Web interface setting...
9c64539
 WebInterface @CUPS_WEBIF@
9c64539
 
9c64539
+# Timeout after cupsd exits if idle (applied only if cupsd runs on-demand - with -l)
9c64539
+IdleExitTimeout @EXIT_TIMEOUT@
9c64539
+
9c64539
 # Restrict access to the server...
9c64539
 <Location />
9c64539
   Order allow,deny
9c64539
diff --git a/config-scripts/cups-defaults.m4 b/config-scripts/cups-defaults.m4
9c64539
index 240a95229..9420e1510 100644
9c64539
--- a/config-scripts/cups-defaults.m4
9c64539
+++ b/config-scripts/cups-defaults.m4
9c64539
@@ -428,3 +428,16 @@ AS_IF([test $CUPS_WEBIF = Yes || test $CUPS_BROWSING = Yes], [
9c64539
   SYSTEMD_WANTED_BY="$SYSTEMD_WANTED_BY multi-user.target"], [
9c64539
   ])
9c64539
 AC_SUBST([SYSTEMD_WANTED_BY])
9c64539
+
9c64539
+dnl Set default value of IdleExitTimeout
9c64539
+AC_ARG_WITH([idle_exit_timeout], AS_HELP_STRING([--with-idle-exit-timeout], [set the default value for IdleExitTimeout, default=60]), [
9c64539
+    AS_IF([test "x$withval" = "xno"], [
9c64539
+	EXIT_TIMEOUT=0
9c64539
+    ], [
9c64539
+	EXIT_TIMEOUT=$withval
9c64539
+    ])
9c64539
+], [
9c64539
+    EXIT_TIMEOUT=60
9c64539
+])
9c64539
+
9c64539
+AC_SUBST([EXIT_TIMEOUT])
9c64539
-- 
9c64539
2.31.1
9c64539