BackgroundJobCleanup
authorSven Schöling <s.schoeling@linet-services.de>
Tue, 30 Oct 2012 11:00:37 +0000 (12:00 +0100)
committerSven Schöling <s.schoeling@linet-services.de>
Fri, 11 Jan 2013 12:56:30 +0000 (13:56 +0100)
SL/BackgroundJob/ALL.pm
SL/BackgroundJob/BackgroundJobCleanup.pm [new file with mode: 0644]
sql/Pg-upgrade2/background_jobs_3.pl [new file with mode: 0644]

index 5688d2c..84c55ee 100644 (file)
@@ -3,6 +3,7 @@ package SL::BackgroundJob::ALL;
 use strict;
 
 use SL::BackgroundJob::Base;
+use SL::BackgroundJob::BackgroundJobCleanup;
 use SL::BackgroundJob::CleanBackgroundJobHistory;
 use SL::BackgroundJob::CreatePeriodicInvoices;
 
diff --git a/SL/BackgroundJob/BackgroundJobCleanup.pm b/SL/BackgroundJob/BackgroundJobCleanup.pm
new file mode 100644 (file)
index 0000000..7d1a58a
--- /dev/null
@@ -0,0 +1,46 @@
+package SL::BackgroundJob::BackgroundJobCleanup;
+
+use strict;
+
+use parent qw(SL::BackgroundJob::Base);
+
+use SL::DB::BackgroundJob;
+
+sub create_job {
+  $_[0]->create_standard_job('0 3 * * *'); # daily at 3:00 am
+}
+
+sub run {
+  SL::DB::Manager::BackgroundJob->cleanup;
+
+  return 1;
+}
+
+1;
+
+__END__
+
+=encoding utf8
+
+=head1 NAME
+
+SL::BackgroundJob::BackgroundJobCleanup - Background job for
+cleaning the background job table of all executed one time jobs
+
+=head1 SYNOPSIS
+
+This background job deletes old entries from the table
+C<background_jobs>. This happens to background jobs that were
+supposed to run only once and were already run.
+
+The job is supposed to run once a day.
+
+=head1 BUGS
+
+Nothing here yet.
+
+=head1 AUTHOR
+
+Sven Schöling E<lt>s.schoeling@linet-services.deE<gt>
+
+=cut
diff --git a/sql/Pg-upgrade2/background_jobs_3.pl b/sql/Pg-upgrade2/background_jobs_3.pl
new file mode 100644 (file)
index 0000000..0236cd5
--- /dev/null
@@ -0,0 +1,13 @@
+#!/usr/bin/perl
+# @tag: background_jobs_3
+# @description: Backgroundjob Cleanup einrichten
+# @depends: emmvee_background_jobs_2
+# @charset: utf-8
+
+use strict;
+
+use SL::BackgroundJob::BackgroundJobCleanup;
+
+SL::BackgroundJob::BackgroundJobCleanup->create_job;
+
+1;