removing warn from XISBN.pm
[koha.git] / C4 / Scheduler.pm
1 package C4::Scheduler;
2
3 # Copyright 2007 Liblime Ltd
4 #
5 # This file is part of Koha.
6 #
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.
11 #
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.
15 #
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
19
20 use strict;
21 require Exporter;
22
23 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
24 use C4::Context;
25 use Schedule::At;
26 # set the version for version checking
27 $VERSION = 0.01;
28
29 @ISA = qw(Exporter);
30 @EXPORT =
31   qw(get_jobs get_at_jobs get_at_job add_at_job remove_at_job);
32
33 =head1 NAME
34
35 C4::Scheduler - Module for running jobs with the unix at command
36
37 =head1 SYNOPSIS
38
39   use C4::Scheduler;
40
41 =head1 DESCRIPTION
42
43
44 =head1 METHODS
45
46 =over 2
47
48 =cut
49
50 =item get_jobs();
51
52 This will return all scheduled jobs
53
54 =cut
55
56 sub get_jobs {
57     my $jobs = get_at_jobs();
58 # add call to get cron jobs here too
59     return ($jobs);
60 }
61
62 =item get_at_jobs();
63
64 This will return all At scheduled jobs
65
66 =cut
67
68 sub get_at_jobs {
69         my %jobs = Schedule::At::getJobs();
70         return (\%jobs);
71 }
72
73 =item get_at_job($id)
74
75 This will return the At job with the given id
76
77 =cut
78
79 sub get_at_job {
80         my ($id)=@_;
81         my %jobs = chedule::At::getJobs(JOBID => $id);
82 }
83
84 =item add_at_job ($time,$command)
85
86 Given a timestamp and a command this will schedule the job to run at that time
87
88 =cut
89
90 sub add_at_job {
91         my ($time,$command) = @_;
92         Schedule::At::add(TIME => $time, COMMAND => $command, TAG => $command);
93 }
94
95 sub remove_at_job {
96         my ($jobid)=@_;
97         Schedule::At::remove(JOBID => $jobid);
98 }
99
100 =head1 AUTHOR
101
102 Chris Cormack <crc@liblime.com>
103
104 =cut
105
106 1;