=head1 NAME

gspl-setspdir - tidy up or redistribute GNUspool jobs into subdirectories

=head1 SYNOPSIS

B<gspl-setspdir>
[ I<-s n> ]
[ I<-r> ]
[ I<-d> ]
[ I<-f form> ]
[ I<-y> ]

=head1 DESCRIPTION

B<gspl-setspdir> tidies up the B<GNUspool> spool directory, removing old
spool files, or alternatively re-queuing them with a given default
form type, and eliminating jobs where the spool file is missing.

Optionally, it may be used to split the main spool directory into a
series of subdirectories C<000>, C<001> etc, reducing the size of the
main spool directory to manageable proportions and also speeding up
file searches. Alternatively, the subdirectories may be linked to
different file systems by the user.

For reasonably obvious reasons, B<gspl-setspdir> should be run with the
spooler shut down.

=head1 OPTIONS

=over 4

=item -d

Clear (delete) any orphaned job files found in the directory or directories.

=item -f I<form>

Requeue any orphaned job files with the form type I<form> rather than
deleting them.

=item -r

Instead of moving jobs between subdirectories, renumber the jobs
instead. This should only apply when there were existing
subdirectories, and the number is being increased.

=item -s I<n>

Split the spool directory into I<n> subdirectories, or change the
number of subdirectories to I<n>, where I<n> may be 0 (to convert back
to a single spool directory), or a number up to 999.

We recommend that I<n> be a prime number, as this minimises the chance
of a cycle of operations which is a factor of the number of
subdirectories causing just a small number of subdirectories to be
filled more or less exclusively. Confirmation will be requested if
I<n> is not prime.

The subdirectories are given the names C<000> to C<999>, and each job
will be moved to a subdirectory given by the remainder when its job
number (the number after the C<SP>) is divided by the number of
subdirectories.

=item -y

Answer "yes" to any questions which B<gspl-setspdir> asks.

=back

=head1 ENVIRONMENT

B<gspl-setspdir> creates or updates the environment variable C<SPOOLSUBDS>
in F<gnuspool.conf>.

=over 8

=item SPOOLDIR

location of spool directory

=item SPOOLSUBDS

number of subdirectories

=back

=head1 SEE ALSO

gspl-cjlist(8),
gspl-cplist(8),
gspl-spuconv(8),
gnuspool.conf(5).

=head1 AUTHOR

John M Collins, Xi Software Ltd.

=cut

## Local Variables:
## mode: nroff
## End:
## LocalWords:  gspl-setspdir SPOOLSUBDS SPOOLDIR gspl-cjlist gspl-cplist gspl-spuconv
