1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
Description: When cupsd is started by systemd, let it die after 30 seconds by default
Author: Didier Raboud <odyx@debian.org>
Last-Update: 2014-10-23
--- a/scheduler/conf.c
+++ b/scheduler/conf.c
@@ -80,6 +80,7 @@
{ "DirtyCleanInterval", &DirtyCleanInterval, CUPSD_VARTYPE_TIME },
{ "ErrorPolicy", &ErrorPolicy, CUPSD_VARTYPE_STRING },
{ "IdleExitTimeout", &IdleExitTimeout, CUPSD_VARTYPE_TIME },
+ { "SystemdIdleExit", &SystemdIdleExit, CUPSD_VARTYPE_BOOLEAN },
{ "FilterLimit", &FilterLimit, CUPSD_VARTYPE_INTEGER },
{ "FilterNice", &FilterNice, CUPSD_VARTYPE_INTEGER },
#ifdef HAVE_GSSAPI
@@ -758,6 +759,7 @@
DefaultLeaseDuration = 86400;
MaxLeaseDuration = 0;
IdleExitTimeout = 0;
+ SystemdIdleExit = FALSE;
#ifdef HAVE_LAUNCHD
LaunchdTimeout = 10;
--- a/scheduler/conf.h
+++ b/scheduler/conf.h
@@ -251,6 +251,9 @@
VAR int IdleExitTimeout VALUE(0);
/* Time after which an idle cupsd will exit */
+VAR int SystemdIdleExit VALUE(FALSE);
+ /* Whether cups when launched by systemd should exit on idle */
+
#ifdef HAVE_LAUNCHD
VAR int LaunchdTimeout VALUE(10);
/* Time after which an idle cupsd will exit */
--- a/scheduler/main.c
+++ b/scheduler/main.c
@@ -1736,6 +1736,15 @@
# endif /* HAVE_SSL */
}
+ if(SystemdIdleExit)
+ {
+ /* As we are started on-demand, stop on idle */
+ if (!IdleExitTimeout)
+ IdleExitTimeout = 30;
+
+ cupsdLogMessage(CUPSD_LOG_DEBUG, "systemd_checkin: Activate exit-on-idle mode, timeout: %d seconds.",
+ IdleExitTimeout);
+ }
return (0);
}
#endif /* HAVE_SYSTEMD */
--- a/man/cupsd.conf.man.in
+++ b/man/cupsd.conf.man.in
@@ -521,6 +521,12 @@
"notify-events", "notify-pull-method", "notify-recipient-uri",
"notify-subscriber-user-name", and "notify-user-data".
.TP 5
+SystemdIdleExit No
+.TP 5
+SystemdIdleExit Yes
+.br
+Specifies whether to exit on inactivity when launched by systemd.
+.TP 5
Timeout seconds
.br
Specifies the HTTP request timeout in seconds.
|