From 19bc00f2f06ffa53668f39e55915b9b0df3970ba Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sven=20Sch=C3=B6ling?= Date: Tue, 30 Oct 2012 12:00:37 +0100 Subject: [PATCH] BackgroundJobCleanup --- SL/BackgroundJob/ALL.pm | 1 + SL/BackgroundJob/BackgroundJobCleanup.pm | 46 ++++++++++++++++++++++++ sql/Pg-upgrade2/background_jobs_3.pl | 13 +++++++ 3 files changed, 60 insertions(+) create mode 100644 SL/BackgroundJob/BackgroundJobCleanup.pm create mode 100644 sql/Pg-upgrade2/background_jobs_3.pl diff --git a/SL/BackgroundJob/ALL.pm b/SL/BackgroundJob/ALL.pm index 5688d2cc8..84c55ee00 100644 --- a/SL/BackgroundJob/ALL.pm +++ b/SL/BackgroundJob/ALL.pm @@ -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 index 000000000..7d1a58a67 --- /dev/null +++ b/SL/BackgroundJob/BackgroundJobCleanup.pm @@ -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. 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 Es.schoeling@linet-services.deE + +=cut diff --git a/sql/Pg-upgrade2/background_jobs_3.pl b/sql/Pg-upgrade2/background_jobs_3.pl new file mode 100644 index 000000000..0236cd55b --- /dev/null +++ b/sql/Pg-upgrade2/background_jobs_3.pl @@ -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; -- 2.20.1