Update issues_stats: add shelving location limit, replace cgi::scrolling_list, update...
[koha.git] / C4 / Scheduler.pm
blob92982fbf4c3efd4b5828d870631fcd726a7fcf70
1 package C4::Scheduler;
3 # Copyright 2007 Liblime Ltd
5 # This file is part of Koha.
7 # Koha is free software; you can redistribute it and/or modify it under the
8 # terms of the GNU General Public License as published by the Free Software
9 # Foundation; either version 2 of the License, or (at your option) any later
10 # version.
12 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License along with
17 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
18 # Suite 330, Boston, MA 02111-1307 USA
20 use strict;
22 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
23 use C4::Context;
24 use Schedule::At;
26 BEGIN {
27 # set the version for version checking
28 $VERSION = 0.02;
29 require Exporter;
30 @ISA = qw(Exporter);
31 @EXPORT =
32 qw(get_jobs get_at_jobs get_at_job add_at_job remove_at_job);
35 =head1 NAME
37 C4::Scheduler - Module for running jobs with the unix at command
39 =head1 SYNOPSIS
41 use C4::Scheduler;
43 =head1 DESCRIPTION
46 =head1 METHODS
48 =over 2
50 =cut
52 =item get_jobs();
54 This will return all scheduled jobs
56 =cut
58 sub get_jobs {
59 my $jobs = get_at_jobs();
60 # add call to get cron jobs here too
61 return ($jobs);
64 =item get_at_jobs();
66 This will return all At scheduled jobs
68 =cut
70 sub get_at_jobs {
71 my %jobs = Schedule::At::getJobs();
72 return (\%jobs);
75 =item get_at_job($id)
77 This will return the At job with the given id
79 =cut
81 sub get_at_job {
82 my ($id)=@_;
83 my %jobs = Schedule::At::getJobs(JOBID => $id);
86 =item add_at_job ($time,$command)
88 Given a timestamp and a command this will schedule the job to run at that time
90 =cut
92 sub add_at_job {
93 my ($time,$command) = @_;
94 Schedule::At::add(TIME => $time, COMMAND => $command, TAG => $command);
97 sub remove_at_job {
98 my ($jobid)=@_;
99 Schedule::At::remove(JOBID => $jobid);
103 __END__
105 =head1 AUTHOR
107 Chris Cormack <crc@liblime.com>
109 =cut