Blob Blame History Raw
From d3bf52f5dc9e465faba69a85eeed5b64916efddd Mon Sep 17 00:00:00 2001
From: Zdenek Dohnal <zdohnal@redhat.com>
Date: Mon, 29 Nov 2021 09:30:26 +0100
Subject: [PATCH] Add --with-idle-exit-timeout configure option

The option enables setting IdleExitTimeout to a desired value - f.e.
setting to zero will disable automatic shutdown, which is useful on servers,
where cupsd is expected to run even if there is no web interface, no jobs
and CUPS doesn't share queues.
---
 CHANGES.md                      |  1 +
 conf/cupsd.conf.in              |  3 +++
 config-scripts/cups-defaults.m4 | 13 +++++++++++++
 configure                       | 30 ++++++++++++++++++++++++++++++
 4 files changed, 47 insertions(+)

diff --git a/conf/cupsd.conf.in b/conf/cupsd.conf.in
index 03d1d5df5..b25884907 100644
--- a/conf/cupsd.conf.in
+++ b/conf/cupsd.conf.in
@@ -28,6 +28,9 @@ DefaultAuthType Basic
 # Web interface setting...
 WebInterface @CUPS_WEBIF@
 
+# Timeout after cupsd exits if idle (applied only if cupsd runs on-demand - with -l)
+IdleExitTimeout @EXIT_TIMEOUT@
+
 # Restrict access to the server...
 <Location />
   Order allow,deny
diff --git a/config-scripts/cups-defaults.m4 b/config-scripts/cups-defaults.m4
index 240a95229..9420e1510 100644
--- a/config-scripts/cups-defaults.m4
+++ b/config-scripts/cups-defaults.m4
@@ -428,3 +428,16 @@ AS_IF([test $CUPS_WEBIF = Yes || test $CUPS_BROWSING = Yes], [
   SYSTEMD_WANTED_BY="$SYSTEMD_WANTED_BY multi-user.target"], [
   ])
 AC_SUBST([SYSTEMD_WANTED_BY])
+
+dnl Set default value of IdleExitTimeout
+AC_ARG_WITH([idle_exit_timeout], AS_HELP_STRING([--with-idle-exit-timeout], [set the default value for IdleExitTimeout, default=60]), [
+    AS_IF([test "x$withval" = "xno"], [
+	EXIT_TIMEOUT=0
+    ], [
+	EXIT_TIMEOUT=$withval
+    ])
+], [
+    EXIT_TIMEOUT=60
+])
+
+AC_SUBST([EXIT_TIMEOUT])
-- 
2.31.1