Automatic cancellation of held jobs after a configured duration #2291

Closed
michaelrsweet opened this Issue Mar 15, 2007 · 3 comments

Comments

Projects
None yet
1 participant
Collaborator

michaelrsweet commented Mar 15, 2007

Version: 1.6-feature
CUPS.org User: murdie

As a CUPS administrator, I'd like to be able to specify a maximum hold duration for held jobs - in cupsd.conf. After this time, the jobs should be cancelled. (In an ideal world, the user should be E-mailed to say that this has happened.)

My desire for this is simply a consequence of my dislike for the untidyness of loose ends. Users hold jobs and forget that they have done so, so I have to enquire whether they still require that the job be held, and cancel it if not, informing them that I have done so.

For my site, 24 hours is probably appropriate, but other sites might want 3 days, or 'indefinite' etc.

John A. Murdie

Collaborator

michaelrsweet commented Jan 13, 2012

CUPS.org User: mike

Moving to CUPS 1.6; we just added a MaxJobTime directive, will add a MaxHoldTime directive to do the same for held jobs.

Collaborator

michaelrsweet commented Feb 16, 2012

CUPS.org User: mike

Fixed in Subversion repository.

Collaborator

michaelrsweet commented Feb 16, 2012

"str2291.patch":

Index: doc/help/ref-cupsd-conf.html.in

--- doc/help/ref-cupsd-conf.html.in (revision 10288)
+++ doc/help/ref-cupsd-conf.html.in (working copy)
@@ -1675,7 +1675,22 @@

+

CUPS 1.6MaxHoldTime

+

Examples


+
+

+MaxHoldTime 10800
+MaxHoldTime 0
+

+
+

Description


+
+

The MaxHoldTime directive controls the maximum number of seconds allowed for a job to remain in the "indefinite" hold state. The job is canceled automatically if it remains held indefinitely longer than the specified number of seconds.


+
+

The default setting is 0 which disables this functionality.


+
+

MaxJobs

Examples

Index: man/cupsd.conf.man.in

--- man/cupsd.conf.man.in (revision 10288)
+++ man/cupsd.conf.man.in (working copy)
@@ -12,7 +12,7 @@
." which should have been included with this file. If this file is
." file is missing or damaged, see the license at "http://www.cups.org/".
."
-.TH cupsd.conf 5 "CUPS" "6 January 2012" "Apple Inc."
+.TH cupsd.conf 5 "CUPS" "15 February 2012" "Apple Inc."
.SH NAME
cupsd.conf - server configuration file for cups
.SH DESCRIPTION
@@ -386,6 +386,11 @@
.br
Specifies the maximum number of copies that a user can print of each job.
.TP 5
+MaxHoldTime seconds
+.br
+Specifies the maximum time a job may remain in the "indefinite" hold state
+before it is canceled. Set to 0 to disable cancellation of held jobs.
+.TP 5
MaxJobs number
.br
Specifies the maximum number of simultaneous jobs to support.
@@ -634,7 +639,7 @@
.br
http://localhost:631/help
.SH COPYRIGHT
-Copyright 2007-2011 by Apple Inc.
+Copyright 2007-2012 by Apple Inc.
."
." End of "$Id$".
."

Index: scheduler/conf.c

--- scheduler/conf.c (revision 10288)
+++ scheduler/conf.c (working copy)
@@ -3,7 +3,7 @@
*

  • Configuration routines for the CUPS scheduler.
  • * Copyright 2007-2011 by Apple Inc.
  • * Copyright 2007-2012 by Apple Inc.
  • Copyright 1997-2007 by Easy Software Products, all rights reserved.
  • These coded instructions, statements, and computer programs are the
    @@ -132,6 +132,7 @@
    { "MaxClientsPerHost", &MaxClientsPerHost, CUPSD_VARTYPE_INTEGER },
    { "MaxCopies", &MaxCopies, CUPSD_VARTYPE_INTEGER },
    { "MaxEvents", &MaxEvents, CUPSD_VARTYPE_INTEGER },
  • { "MaxHoldTime", &MaxHoldTime, CUPSD_VARTYPE_INTEGER },
    { "MaxJobs", &MaxJobs, CUPSD_VARTYPE_INTEGER },
    { "MaxJobsPerPrinter", &MaxJobsPerPrinter, CUPSD_VARTYPE_INTEGER },
    { "MaxJobsPerUser", &MaxJobsPerUser, CUPSD_VARTYPE_INTEGER },
    @@ -743,6 +744,7 @@
    JobHistory = DEFAULT_HISTORY;
    JobFiles = DEFAULT_FILES;
    JobAutoPurge = 0;
  • MaxHoldTime = 0;
    MaxJobs = 500;
    MaxActiveJobs = 0;
    MaxJobsPerUser = 0;
    Index: scheduler/job.c
    ===================================================================
    --- scheduler/job.c (revision 10299)
    +++ scheduler/job.c (working copy)
    @@ -2247,6 +2247,8 @@
  • Update the hold time...
    */
  • job->cancel_time = 0;

if (!strcmp(when, "indefinite") || !strcmp(when, "auth-info-required"))
{
/*
@@ -2254,6 +2256,9 @@
*/

job->hold_until = 0;
+

  • if (MaxHoldTime > 0)
  •  job->cancel_time = time(NULL) + MaxHoldTime;
    

    }
    else if (!strcmp(when, "day-time"))
    {
    Index: scheduler/job.h

    --- scheduler/job.h (revision 10288)
    +++ scheduler/job.h (working copy)
    @@ -99,6 +99,8 @@
    /* Max number of jobs /
    MaxActiveJobs VALUE(0),
    /
    Max number of active jobs */
  •       MaxHoldTime VALUE(0),
    
  •               /\* Max time for indefinite hold _/
        MaxJobsPerUser  VALUE(0),
                /_ Max jobs per user */
        MaxJobsPerPrinter VALUE(0),
    

michaelrsweet added this to the Stable milestone Mar 17, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment