PURGE

NAME
SYNOPSIS
DESCRIPTION
OPTIONS
ENVIRONMENT
FILES
EXAMPLES
AUTHOR
REPORTING BUGS
COPYRIGHT
SEE ALSO

NAME

purge - purges the NOAH Documentation Database WasteBasket

SYNOPSIS

purge [database=DATABASE] [-zip] [-unzip] [-t] [-k N] [-daily_at HOUR] [-w filename] [-w] [-h]

DESCRIPTION

This is a program setup and used by an administrator of a NOAH Document Management Database.

There may be a wrapper script in /usr/bin with noah- prefix that calls this program in the correct run directory.

The purge program reads the NOAH database entries and moves deleted files (i.e. WasteBasket files) out of the general NOAH database and into the waste directory found below DATA_DIR. It also moves file VERSIONS that have been marked as DELETED out of the NOAH database and into this waste directory.

The idea is never to actually delete any files, just move them and leave it up to the NOAH Administrator to decide if or when files should be permanently deleted or archived.

To keep the waste directory easy to manage, sub directories are created by purge. The first directory created is the DATE directory with the directory name set to the current date (in YYYY-mmm-DD format).

Below this DATE directory, the TIME directory is created. Each one of the TIME directories, has a waste version of the database files (.tab files) with only entries for the deleted files and versions and directories. In this time directory, the files and file versions themselves are found along with individual *meta-data.txt files that contain the meta-data for each file.

The *meta-data.txt files lend themselves to common search tools such as grep or find making it easy to search for files from meta-data outside of the NOAH server environment.

For example, if these files were transferred to cd-rom, one might want to sort and search through these archives for a particular document TITLE or AUTHOR. This would be easy to do in this format.

Since purge uses file-locking just like the cgi-bin programs, there is no need to disable the NOAH server to do backups.

OPTIONS

In addition to the purging of the WasteBasket, purge has some more cleanup and database management options as described next.

-zip
Goes through all database files and zips them up into a doc.zip file in each dir-*00 directory in the database. This saves space on a crowded hard disk. NOAH knows how to look for these doc.zip files if it can’t open the file it knows should be there!

-unzip
Goes through all database files and unzips them from the doc.zip file in each dir-*00 directory. This option does NOT delete the doc.zip files.

-database DATABASE
Defines the database that purge will worked on. The default value is default.

-v
Sets a more verbose logging of that the tool is doing.

-t
Delete the NOAH TEMP_DIR directory to remove any user files left over from zip downloading.

If a user is in the middle of downloading a multi-file zip when purge is run with this option, the users file would get deleted and the user would have to start the download again. For this reason, it is recommended that this option be used when there is little activity on the NOAH server.

-keepmonths N
Leave files and directories in the WasteBasket folder that have been deleted in the last N MONTHS.

It is easy to see which files these are since the WasteBasket organizes file and directory deletes in year-month (YYYY-MM) sub-directories. In addition, log file entries that are less than N months old will not be removed.

Remember that purge never deletes files from the server but only moves files out of the database and into a time/date stamped waste directory. Admittedly it would take some effort to push this data back into NOAH - but the most important point is that the files are not gone nor is the meta data associated with the files.

The default keepmonths is 2 which means that if you want to completely purge your Wastebasket and log file, use purge -k 0.

With the default keepmonths setting of 2 months, you can run the purge command once a day (probably late at night when there are few or no NOAH users logged on) to keep the WasteBasket trimmed down to deletes that are less than 2 months old.

-daily_at HOUR
Only run purge once a day when the hour reaches HOUR (0 to 23).

This is a useful feature if you want to add the purge command to your email.bat (Windows) or email.bash (Linux) scheduled script where the repetition rate is typically every 5 minutes but you only want to run the purge command once a day. This is probably more useful in a Windows installation since it can be awkward setting up and monitoring multiple scheduled tasks in some windows installations.

Scheduling - crontab
If NOAH is installed on a WINDOWS Client OS like Win-XP, the most convenient way of scheduling purge is through the Windows Scheduling tool.

On a unix machine, you will use crontab and the Debian release automatically creates a crontab file with a purge line appropriately setup in the /etc/cron.d/noah file.

-h
short usage help

-help
This help document.

ENVIRONMENT

This program is found in the admin directory and expects to be run from there.

In a Debian distribution, this program has a link to the wrapper program in the admin directory typically /usr/lib/noah/admin and the link name has a noah- prefix and is found in /usr/bin.

FILES

/usr/bin/purge

This is a link to wrapper

/usr/lib/noah/admin/wrapper

This is a generic bash shell wrapper to start the program in the admin directory.

/usr/lib/noah/admin/purge

This is the actual executable called by the wrapper.

/usr/lib/noah/database.config

This is typically a link to /etc/noah/database.config in a Debian release.

TEMP_DIR/purge.DATABASE.dailyat

Temporary file used to determine if daily purge has yet been done.

EXAMPLES

purge -t -zip -keep_months 2
This example will purge the WasteBasket of files and directories that are older than two months. In addition, the TEMP_DIR is cleaned out and any files that have not already been zipped up are zipped to save disk space.

purge -t -zip -daily_at 4
This example is similar to the previous except it will do nothing unless it is the first time it is called at 4AM. You might set this up this way because it is part of a regular 5 minute scheduled job managing emails etc. and you don’t want to have to manage another WINDOWS schedule item.

AUTHOR

Harold Blount - Nordicwind Inc. www.nordicwind.ca

REPORTING BUGS

http://noah.@nordicwind.ca

COPYRIGHT

NOAH - Copyright (c) 2004-2012 Nordicwind Inc. All rights reserved. <http://www.nordicwind.ca>

This is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 or later <http://gnu.org/licenses/gpl.html>.

This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

SEE ALSO

noah-help

Noah Document Management Server : http://noah.nordicwind.ca