Skip to content

Commit

Permalink
Purge jobs database of old jobs.
Browse files Browse the repository at this point in the history
  • Loading branch information
kjolley committed Apr 24, 2015
1 parent 9cf131b commit 697ab1d
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,20 @@ any database in the past 6 months (the script will run at 6pm every Sunday). ::

#Prevent prefs database getting too large
00 18 * * 0 postgres psql -c "DELETE FROM guid WHERE last_accessed < NOW() - INTERVAL '6 months'" bigsdb_prefs
***************************************
Purging old jobs from the jobs database
***************************************
If you are running the offline job manager, the jobs database (default
bigsdb_jobs) contains the parameters and output messages of these jobs. Job
output files are only
:ref:`usually kept on the server for 7 days<delete-temp-files>` so there is
no point keeping the database entries for longer than this. These can be
purged with a daily cron job, e.g. set the following in /etc/crontab (the
script will run at 5am every day). ::

#Purge jobs older than 7 days from the jobs database.
00 5 * * * postgres psql -c "DELETE FROM jobs where (stop_time IS NOT NULL AND stop_time < now()-interval '7 days') OR (status LIKE 'rejected%' AND submit_time < now()-interval '7 days')" bigsdb_jobs > /dev/null 2>&1

*****************
Log file rotation
Expand Down

0 comments on commit 697ab1d

Please sign in to comment.